<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<HTML>
<HEAD>
<LINK REL=STYLESHEET TYPE="text/css" HREF="../stylesheet.css" TITLE="Style">
<META NAME="GENERATOR" CONTENT="Java2HTML Version 1.5">
<TITLE>jminusminus.NLIRInstruction (Java2HTML)</TITLE>
</HEAD>
<BODY><TABLE id="Header" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td colspan="2" width="33%">&nbsp;</td>
<td align="center" colspan="2" width="33%">
<font size="4">NLIRInstruction.java</font>
</td>
<td align="right" colspan="2" width="33%">&nbsp;</td>
</tr>
</TABLE>
<pre ID="Classes">
<FONT ID="LN">1   </FONT><A NAME="1"></A><FONT ID="SingleLineComment">// Copyright 2013 Bill Campbell, Swami Iyer and Bahar Akbal-Delibas
<FONT ID="LN">2   </FONT><A NAME="2"></A></FONT>
<FONT ID="LN">3   </FONT><A NAME="3"></A><FONT ID="Package">package</FONT> jminusminus;
<FONT ID="LN">4   </FONT><A NAME="4"></A>
<FONT ID="LN">5   </FONT><A NAME="5"></A><FONT ID="Import">import</FONT> <FONT ID="Static">static</FONT> <A HREF="../jminusminus/CLConstants.java.html">jminusminus.CLConstants</A>.*;
<FONT ID="LN">6   </FONT><A NAME="6"></A><FONT ID="Import">import</FONT> <FONT ID="Static">static</FONT> jminusminus.NPhysicalRegister.*;
<FONT ID="LN">7   </FONT><A NAME="7"></A><FONT ID="Import">import</FONT> java.io.PrintWriter;
<FONT ID="LN">8   </FONT><A NAME="8"></A><FONT ID="Import">import</FONT> java.util.ArrayList;
<FONT ID="LN">9   </FONT><A NAME="9"></A>
<FONT ID="LN">10  </FONT><A NAME="10"></A><FONT ID="FormalComment">/**
<FONT ID="LN">11  </FONT><A NAME="11"></A> * Low-level intermediate representation (LIR) of a JVM instruction.
<FONT ID="LN">12  </FONT><A NAME="12"></A> */</FONT>
<FONT ID="LN">13  </FONT><A NAME="13"></A>
<FONT ID="LN">14  </FONT><A NAME="14"></A><FONT ID="Abstract">abstract</FONT> <FONT ID="Class">class</FONT> NLIRInstruction {
<FONT ID="LN">15  </FONT><A NAME="15"></A>
<FONT ID="LN">16  </FONT><A NAME="16"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">17  </FONT><A NAME="17"></A>     * Maps JVM opcode to a string mnemonic for LIR instructions. For example,
<FONT ID="LN">18  </FONT><A NAME="18"></A>     * imul is mapped to the "MUL".
<FONT ID="LN">19  </FONT><A NAME="19"></A>     */</FONT>
<FONT ID="LN">20  </FONT><A NAME="20"></A>    <FONT ID="Protected">protected</FONT> <FONT ID="Static">static</FONT> String[] lirMnemonic;
<FONT ID="LN">21  </FONT><A NAME="21"></A>    <FONT ID="Static">static</FONT> {
<FONT ID="LN">22  </FONT><A NAME="22"></A>        lirMnemonic = <FONT ID="New">new</FONT> String[<FONT ID="IntegerLiteral">256</FONT>];
<FONT ID="LN">23  </FONT><A NAME="23"></A>        lirMnemonic[IADD] = <FONT ID="StringLiteral">"ADD"</FONT>;
<FONT ID="LN">24  </FONT><A NAME="24"></A>        lirMnemonic[IMUL] = <FONT ID="StringLiteral">"MUL"</FONT>;
<FONT ID="LN">25  </FONT><A NAME="25"></A>        lirMnemonic[ISUB] = <FONT ID="StringLiteral">"SUB"</FONT>;
<FONT ID="LN">26  </FONT><A NAME="26"></A>        lirMnemonic[MULTIANEWARRAY] = <FONT ID="StringLiteral">"MULTIANEWARRAY"</FONT>;
<FONT ID="LN">27  </FONT><A NAME="27"></A>        lirMnemonic[AALOAD] = <FONT ID="StringLiteral">"AALOAD"</FONT>;
<FONT ID="LN">28  </FONT><A NAME="28"></A>        lirMnemonic[IALOAD] = <FONT ID="StringLiteral">"IALOAD"</FONT>;
<FONT ID="LN">29  </FONT><A NAME="29"></A>        lirMnemonic[IASTORE] = <FONT ID="StringLiteral">"IASTORE"</FONT>;
<FONT ID="LN">30  </FONT><A NAME="30"></A>        lirMnemonic[IF_ICMPNE] = <FONT ID="StringLiteral">"NE"</FONT>;
<FONT ID="LN">31  </FONT><A NAME="31"></A>        lirMnemonic[IF_ICMPGT] = <FONT ID="StringLiteral">"GT"</FONT>;
<FONT ID="LN">32  </FONT><A NAME="32"></A>        lirMnemonic[IF_ICMPLE] = <FONT ID="StringLiteral">"LE"</FONT>;
<FONT ID="LN">33  </FONT><A NAME="33"></A>        lirMnemonic[GETSTATIC] = <FONT ID="StringLiteral">"GETSTATIC"</FONT>;
<FONT ID="LN">34  </FONT><A NAME="34"></A>        lirMnemonic[PUTSTATIC] = <FONT ID="StringLiteral">"PUTSTATIC"</FONT>;
<FONT ID="LN">35  </FONT><A NAME="35"></A>        lirMnemonic[INVOKESPECIAL] = <FONT ID="StringLiteral">"INVOKESPECIAL"</FONT>;
<FONT ID="LN">36  </FONT><A NAME="36"></A>        lirMnemonic[INVOKESTATIC] = <FONT ID="StringLiteral">"INVOKESTATIC"</FONT>;
<FONT ID="LN">37  </FONT><A NAME="37"></A>    }
<FONT ID="LN">38  </FONT><A NAME="38"></A>
<FONT ID="LN">39  </FONT><A NAME="39"></A>    <FONT ID="FormalComment">/** The block containing this instruction. */</FONT>
<FONT ID="LN">40  </FONT><A NAME="40"></A>    <FONT ID="Public">public</FONT> NBasicBlock block;
<FONT ID="LN">41  </FONT><A NAME="41"></A>
<FONT ID="LN">42  </FONT><A NAME="42"></A>    <FONT ID="FormalComment">/** Unique identifier of this instruction. */</FONT>
<FONT ID="LN">43  </FONT><A NAME="43"></A>    <FONT ID="Public">public</FONT> <FONT ID="Int">int</FONT> id;
<FONT ID="LN">44  </FONT><A NAME="44"></A>
<FONT ID="LN">45  </FONT><A NAME="45"></A>    <FONT ID="FormalComment">/** Registers that store the inputs (if any) of this instruction. */</FONT>
<FONT ID="LN">46  </FONT><A NAME="46"></A>    <FONT ID="Public">public</FONT> ArrayList&lt;<A HREF="../jminusminus/NRegister.java.html">NRegister</A>&gt; reads;
<FONT ID="LN">47  </FONT><A NAME="47"></A>
<FONT ID="LN">48  </FONT><A NAME="48"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">49  </FONT><A NAME="49"></A>     * Register that stores the result (if any) of this instruction.
<FONT ID="LN">50  </FONT><A NAME="50"></A>     */</FONT>
<FONT ID="LN">51  </FONT><A NAME="51"></A>    <FONT ID="Public">public</FONT> <A HREF="../jminusminus/NRegister.java.html">NRegister</A> write;
<FONT ID="LN">52  </FONT><A NAME="52"></A>
<FONT ID="LN">53  </FONT><A NAME="53"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">54  </FONT><A NAME="54"></A>     * Construct an NLIRInstruction.
<FONT ID="LN">55  </FONT><A NAME="55"></A>     * 
<FONT ID="LN">56  </FONT><A NAME="56"></A>     * @param block
<FONT ID="LN">57  </FONT><A NAME="57"></A>     *            enclosing block.
<FONT ID="LN">58  </FONT><A NAME="58"></A>     * @param id
<FONT ID="LN">59  </FONT><A NAME="59"></A>     *            identifier of the instruction.
<FONT ID="LN">60  </FONT><A NAME="60"></A>     */</FONT>
<FONT ID="LN">61  </FONT><A NAME="61"></A>
<FONT ID="LN">62  </FONT><A NAME="62"></A>    <FONT ID="Protected">protected</FONT> NLIRInstruction(NBasicBlock block, <FONT ID="Int">int</FONT> id) {
<FONT ID="LN">63  </FONT><A NAME="63"></A>        <FONT ID="This">this</FONT>.block = block;
<FONT ID="LN">64  </FONT><A NAME="64"></A>        <FONT ID="This">this</FONT>.id = id;
<FONT ID="LN">65  </FONT><A NAME="65"></A>        reads = <FONT ID="New">new</FONT> ArrayList&lt;<A HREF="../jminusminus/NRegister.java.html">NRegister</A>&gt;();
<FONT ID="LN">66  </FONT><A NAME="66"></A>    }
<FONT ID="LN">67  </FONT><A NAME="67"></A>
<FONT ID="LN">68  </FONT><A NAME="68"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">69  </FONT><A NAME="69"></A>     * Replace references to virtual registers in this LIR instruction with
<FONT ID="LN">70  </FONT><A NAME="70"></A>     * references to physical registers.
<FONT ID="LN">71  </FONT><A NAME="71"></A>     */</FONT>
<FONT ID="LN">72  </FONT><A NAME="72"></A>
<FONT ID="LN">73  </FONT><A NAME="73"></A>    <FONT ID="Public">public</FONT> <FONT ID="Void">void</FONT> allocatePhysicalRegisters() {
<FONT ID="LN">74  </FONT><A NAME="74"></A>        <FONT ID="SingleLineComment">// nothing here.
<FONT ID="LN">75  </FONT><A NAME="75"></A></FONT>    }
<FONT ID="LN">76  </FONT><A NAME="76"></A>
<FONT ID="LN">77  </FONT><A NAME="77"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">78  </FONT><A NAME="78"></A>     * Translate this LIR instruction into SPIM and write it out to the
<FONT ID="LN">79  </FONT><A NAME="79"></A>     * specified output stream.
<FONT ID="LN">80  </FONT><A NAME="80"></A>     * 
<FONT ID="LN">81  </FONT><A NAME="81"></A>     * @param out
<FONT ID="LN">82  </FONT><A NAME="82"></A>     *            output stream for SPIM code.
<FONT ID="LN">83  </FONT><A NAME="83"></A>     */</FONT>
<FONT ID="LN">84  </FONT><A NAME="84"></A>
<FONT ID="LN">85  </FONT><A NAME="85"></A>    <FONT ID="Public">public</FONT> <FONT ID="Void">void</FONT> toSpim(PrintWriter out) {
<FONT ID="LN">86  </FONT><A NAME="86"></A>        <FONT ID="SingleLineComment">// nothing here.
<FONT ID="LN">87  </FONT><A NAME="87"></A></FONT>    }
<FONT ID="LN">88  </FONT><A NAME="88"></A>
<FONT ID="LN">89  </FONT><A NAME="89"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">90  </FONT><A NAME="90"></A>     * Return a string representation of this instruction.
<FONT ID="LN">91  </FONT><A NAME="91"></A>     * 
<FONT ID="LN">92  </FONT><A NAME="92"></A>     * @return string representation of this instruction.
<FONT ID="LN">93  </FONT><A NAME="93"></A>     */</FONT>
<FONT ID="LN">94  </FONT><A NAME="94"></A>
<FONT ID="LN">95  </FONT><A NAME="95"></A>    <FONT ID="Public">public</FONT> String toString() {
<FONT ID="LN">96  </FONT><A NAME="96"></A>        <FONT ID="Return">return</FONT> <FONT ID="StringLiteral">""</FONT> + id;
<FONT ID="LN">97  </FONT><A NAME="97"></A>    }
<FONT ID="LN">98  </FONT><A NAME="98"></A>
<FONT ID="LN">99  </FONT><A NAME="99"></A>}
<FONT ID="LN">100 </FONT><A NAME="100"></A>
<FONT ID="LN">101 </FONT><A NAME="101"></A><FONT ID="FormalComment">/**
<FONT ID="LN">102 </FONT><A NAME="102"></A> * LIR instruction corresponding to the JVM arithmetic instructions.
<FONT ID="LN">103 </FONT><A NAME="103"></A> */</FONT>
<FONT ID="LN">104 </FONT><A NAME="104"></A>
<FONT ID="LN">105 </FONT><A NAME="105"></A><FONT ID="Class">class</FONT> NLIRArithmetic <FONT ID="Extends">extends</FONT> <A HREF="../jminusminus/NLIRInstruction.java.html">NLIRInstruction</A> {
<FONT ID="LN">106 </FONT><A NAME="106"></A>
<FONT ID="LN">107 </FONT><A NAME="107"></A>    <FONT ID="FormalComment">/** Opcode for the arithmetic operator. */</FONT>
<FONT ID="LN">108 </FONT><A NAME="108"></A>    <FONT ID="Private">private</FONT> <FONT ID="Int">int</FONT> opcode;
<FONT ID="LN">109 </FONT><A NAME="109"></A>
<FONT ID="LN">110 </FONT><A NAME="110"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">111 </FONT><A NAME="111"></A>     * Construct an NLIRArithmetic instruction.
<FONT ID="LN">112 </FONT><A NAME="112"></A>     * 
<FONT ID="LN">113 </FONT><A NAME="113"></A>     * @param block
<FONT ID="LN">114 </FONT><A NAME="114"></A>     *            enclosing block.
<FONT ID="LN">115 </FONT><A NAME="115"></A>     * @param id
<FONT ID="LN">116 </FONT><A NAME="116"></A>     *            identifier of the instruction.
<FONT ID="LN">117 </FONT><A NAME="117"></A>     * @param opcode
<FONT ID="LN">118 </FONT><A NAME="118"></A>     *            opcode for the arithmetic operator.
<FONT ID="LN">119 </FONT><A NAME="119"></A>     * @param lhs
<FONT ID="LN">120 </FONT><A NAME="120"></A>     *            LIR for lhs.
<FONT ID="LN">121 </FONT><A NAME="121"></A>     * @param rhs
<FONT ID="LN">122 </FONT><A NAME="122"></A>     *            LIR for rhs.
<FONT ID="LN">123 </FONT><A NAME="123"></A>     */</FONT>
<FONT ID="LN">124 </FONT><A NAME="124"></A>
<FONT ID="LN">125 </FONT><A NAME="125"></A>    <FONT ID="Public">public</FONT> NLIRArithmetic(NBasicBlock block, <FONT ID="Int">int</FONT> id, <FONT ID="Int">int</FONT> opcode,
<FONT ID="LN">126 </FONT><A NAME="126"></A>            <A HREF="../jminusminus/NLIRInstruction.java.html">NLIRInstruction</A> lhs, <A HREF="../jminusminus/NLIRInstruction.java.html">NLIRInstruction</A> rhs) {
<FONT ID="LN">127 </FONT><A NAME="127"></A>        <FONT ID="Super">super</FONT>(block, id);
<FONT ID="LN">128 </FONT><A NAME="128"></A>        <FONT ID="This">this</FONT>.opcode = opcode;
<FONT ID="LN">129 </FONT><A NAME="129"></A>        reads.add(lhs.write);
<FONT ID="LN">130 </FONT><A NAME="130"></A>        reads.add(rhs.write);
<FONT ID="LN">131 </FONT><A NAME="131"></A>        write = <FONT ID="New">new</FONT> NVirtualRegister(NControlFlowGraph.regId++, <FONT ID="StringLiteral">"I"</FONT>, <FONT ID="StringLiteral">"I"</FONT>);
<FONT ID="LN">132 </FONT><A NAME="132"></A>        block.cfg.registers.add((NVirtualRegister) write);
<FONT ID="LN">133 </FONT><A NAME="133"></A>    }
<FONT ID="LN">134 </FONT><A NAME="134"></A>
<FONT ID="LN">135 </FONT><A NAME="135"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">136 </FONT><A NAME="136"></A>     * @inheritDoc
<FONT ID="LN">137 </FONT><A NAME="137"></A>     */</FONT>
<FONT ID="LN">138 </FONT><A NAME="138"></A>
<FONT ID="LN">139 </FONT><A NAME="139"></A>    <FONT ID="Public">public</FONT> <FONT ID="Void">void</FONT> allocatePhysicalRegisters() {
<FONT ID="LN">140 </FONT><A NAME="140"></A>        <A HREF="../jminusminus/NInterval.java.html">NInterval</A> input1 = block.cfg.intervals.get(reads.get(<FONT ID="IntegerLiteral">0</FONT>).number())
<FONT ID="LN">141 </FONT><A NAME="141"></A>                .childAt(id);
<FONT ID="LN">142 </FONT><A NAME="142"></A>        <A HREF="../jminusminus/NInterval.java.html">NInterval</A> input2 = block.cfg.intervals.get(reads.get(<FONT ID="IntegerLiteral">1</FONT>).number())
<FONT ID="LN">143 </FONT><A NAME="143"></A>                .childAt(id);
<FONT ID="LN">144 </FONT><A NAME="144"></A>        <A HREF="../jminusminus/NInterval.java.html">NInterval</A> output = block.cfg.intervals.get(write.number()).childAt(id);
<FONT ID="LN">145 </FONT><A NAME="145"></A>        reads.set(<FONT ID="IntegerLiteral">0</FONT>, input1.pRegister);
<FONT ID="LN">146 </FONT><A NAME="146"></A>        reads.set(<FONT ID="IntegerLiteral">1</FONT>, input2.pRegister);
<FONT ID="LN">147 </FONT><A NAME="147"></A>        write = output.pRegister;
<FONT ID="LN">148 </FONT><A NAME="148"></A>    }
<FONT ID="LN">149 </FONT><A NAME="149"></A>
<FONT ID="LN">150 </FONT><A NAME="150"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">151 </FONT><A NAME="151"></A>     * @inheritDoc
<FONT ID="LN">152 </FONT><A NAME="152"></A>     */</FONT>
<FONT ID="LN">153 </FONT><A NAME="153"></A>
<FONT ID="LN">154 </FONT><A NAME="154"></A>    <FONT ID="Public">public</FONT> <FONT ID="Void">void</FONT> toSpim(PrintWriter out) {
<FONT ID="LN">155 </FONT><A NAME="155"></A>        <FONT ID="Switch">switch</FONT> (opcode) {
<FONT ID="LN">156 </FONT><A NAME="156"></A>        <FONT ID="Case">case</FONT> IADD:
<FONT ID="LN">157 </FONT><A NAME="157"></A>            out.printf(<FONT ID="StringLiteral">"    add %s,%s,%s\n"</FONT>, write, reads.get(<FONT ID="IntegerLiteral">0</FONT>), reads.get(<FONT ID="IntegerLiteral">1</FONT>));
<FONT ID="LN">158 </FONT><A NAME="158"></A>            <FONT ID="Break">break</FONT>;
<FONT ID="LN">159 </FONT><A NAME="159"></A>        <FONT ID="Case">case</FONT> ISUB:
<FONT ID="LN">160 </FONT><A NAME="160"></A>            out.printf(<FONT ID="StringLiteral">"    sub %s,%s,%s\n"</FONT>, write, reads.get(<FONT ID="IntegerLiteral">0</FONT>), reads.get(<FONT ID="IntegerLiteral">1</FONT>));
<FONT ID="LN">161 </FONT><A NAME="161"></A>            <FONT ID="Break">break</FONT>;
<FONT ID="LN">162 </FONT><A NAME="162"></A>        <FONT ID="Case">case</FONT> IMUL:
<FONT ID="LN">163 </FONT><A NAME="163"></A>            out.printf(<FONT ID="StringLiteral">"    mul %s,%s,%s\n"</FONT>, write, reads.get(<FONT ID="IntegerLiteral">0</FONT>), reads.get(<FONT ID="IntegerLiteral">1</FONT>));
<FONT ID="LN">164 </FONT><A NAME="164"></A>            <FONT ID="Break">break</FONT>;
<FONT ID="LN">165 </FONT><A NAME="165"></A>        }
<FONT ID="LN">166 </FONT><A NAME="166"></A>    }
<FONT ID="LN">167 </FONT><A NAME="167"></A>
<FONT ID="LN">168 </FONT><A NAME="168"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">169 </FONT><A NAME="169"></A>     * @inheritDoc
<FONT ID="LN">170 </FONT><A NAME="170"></A>     */</FONT>
<FONT ID="LN">171 </FONT><A NAME="171"></A>
<FONT ID="LN">172 </FONT><A NAME="172"></A>    <FONT ID="Public">public</FONT> String toString() {
<FONT ID="LN">173 </FONT><A NAME="173"></A>        <FONT ID="Return">return</FONT> id + <FONT ID="StringLiteral">": "</FONT> + lirMnemonic[opcode] + <FONT ID="StringLiteral">" "</FONT> + reads.get(<FONT ID="IntegerLiteral">0</FONT>) + <FONT ID="StringLiteral">" "</FONT>
<FONT ID="LN">174 </FONT><A NAME="174"></A>                + reads.get(<FONT ID="IntegerLiteral">1</FONT>) + <FONT ID="StringLiteral">" "</FONT> + write;
<FONT ID="LN">175 </FONT><A NAME="175"></A>    }
<FONT ID="LN">176 </FONT><A NAME="176"></A>
<FONT ID="LN">177 </FONT><A NAME="177"></A>}
<FONT ID="LN">178 </FONT><A NAME="178"></A>
<FONT ID="LN">179 </FONT><A NAME="179"></A><FONT ID="FormalComment">/**
<FONT ID="LN">180 </FONT><A NAME="180"></A> * LIR instruction corresponding to the JVM instructions representing integer
<FONT ID="LN">181 </FONT><A NAME="181"></A> * constants.
<FONT ID="LN">182 </FONT><A NAME="182"></A> */</FONT>
<FONT ID="LN">183 </FONT><A NAME="183"></A>
<FONT ID="LN">184 </FONT><A NAME="184"></A><FONT ID="Class">class</FONT> NLIRIntConstant <FONT ID="Extends">extends</FONT> <A HREF="../jminusminus/NLIRInstruction.java.html">NLIRInstruction</A> {
<FONT ID="LN">185 </FONT><A NAME="185"></A>
<FONT ID="LN">186 </FONT><A NAME="186"></A>    <FONT ID="FormalComment">/** The constant int value. */</FONT>
<FONT ID="LN">187 </FONT><A NAME="187"></A>    <FONT ID="Public">public</FONT> <FONT ID="Int">int</FONT> value;
<FONT ID="LN">188 </FONT><A NAME="188"></A>
<FONT ID="LN">189 </FONT><A NAME="189"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">190 </FONT><A NAME="190"></A>     * Construct an NLIRIntConstant instruction.
<FONT ID="LN">191 </FONT><A NAME="191"></A>     * 
<FONT ID="LN">192 </FONT><A NAME="192"></A>     * @param block
<FONT ID="LN">193 </FONT><A NAME="193"></A>     *            enclosing block.
<FONT ID="LN">194 </FONT><A NAME="194"></A>     * @param id
<FONT ID="LN">195 </FONT><A NAME="195"></A>     *            identifier of the instruction.
<FONT ID="LN">196 </FONT><A NAME="196"></A>     * @param value
<FONT ID="LN">197 </FONT><A NAME="197"></A>     *            the constant int value.
<FONT ID="LN">198 </FONT><A NAME="198"></A>     */</FONT>
<FONT ID="LN">199 </FONT><A NAME="199"></A>
<FONT ID="LN">200 </FONT><A NAME="200"></A>    <FONT ID="Public">public</FONT> NLIRIntConstant(NBasicBlock block, <FONT ID="Int">int</FONT> id, <FONT ID="Int">int</FONT> value) {
<FONT ID="LN">201 </FONT><A NAME="201"></A>        <FONT ID="Super">super</FONT>(block, id);
<FONT ID="LN">202 </FONT><A NAME="202"></A>        <FONT ID="This">this</FONT>.value = value;
<FONT ID="LN">203 </FONT><A NAME="203"></A>        write = <FONT ID="New">new</FONT> NVirtualRegister(NControlFlowGraph.regId++, <FONT ID="StringLiteral">"I"</FONT>, <FONT ID="StringLiteral">"I"</FONT>);
<FONT ID="LN">204 </FONT><A NAME="204"></A>        block.cfg.registers.add((NVirtualRegister) write);
<FONT ID="LN">205 </FONT><A NAME="205"></A>    }
<FONT ID="LN">206 </FONT><A NAME="206"></A>
<FONT ID="LN">207 </FONT><A NAME="207"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">208 </FONT><A NAME="208"></A>     * @inheritDoc
<FONT ID="LN">209 </FONT><A NAME="209"></A>     */</FONT>
<FONT ID="LN">210 </FONT><A NAME="210"></A>
<FONT ID="LN">211 </FONT><A NAME="211"></A>    <FONT ID="Public">public</FONT> <FONT ID="Void">void</FONT> allocatePhysicalRegisters() {
<FONT ID="LN">212 </FONT><A NAME="212"></A>        <A HREF="../jminusminus/NInterval.java.html">NInterval</A> output = block.cfg.intervals.get(write.number()).childAt(id);
<FONT ID="LN">213 </FONT><A NAME="213"></A>        write = output.pRegister;
<FONT ID="LN">214 </FONT><A NAME="214"></A>    }
<FONT ID="LN">215 </FONT><A NAME="215"></A>
<FONT ID="LN">216 </FONT><A NAME="216"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">217 </FONT><A NAME="217"></A>     * @inheritDoc
<FONT ID="LN">218 </FONT><A NAME="218"></A>     */</FONT>
<FONT ID="LN">219 </FONT><A NAME="219"></A>
<FONT ID="LN">220 </FONT><A NAME="220"></A>    <FONT ID="Public">public</FONT> <FONT ID="Void">void</FONT> toSpim(PrintWriter out) {
<FONT ID="LN">221 </FONT><A NAME="221"></A>        out.printf(<FONT ID="StringLiteral">"    li %s,%d\n"</FONT>, write, value);
<FONT ID="LN">222 </FONT><A NAME="222"></A>    }
<FONT ID="LN">223 </FONT><A NAME="223"></A>
<FONT ID="LN">224 </FONT><A NAME="224"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">225 </FONT><A NAME="225"></A>     * @inheritDoc
<FONT ID="LN">226 </FONT><A NAME="226"></A>     */</FONT>
<FONT ID="LN">227 </FONT><A NAME="227"></A>
<FONT ID="LN">228 </FONT><A NAME="228"></A>    <FONT ID="Public">public</FONT> String toString() {
<FONT ID="LN">229 </FONT><A NAME="229"></A>        <FONT ID="Return">return</FONT> id + <FONT ID="StringLiteral">": LDC ["</FONT> + value + <FONT ID="StringLiteral">"] "</FONT> + write;
<FONT ID="LN">230 </FONT><A NAME="230"></A>    }
<FONT ID="LN">231 </FONT><A NAME="231"></A>
<FONT ID="LN">232 </FONT><A NAME="232"></A>}
<FONT ID="LN">233 </FONT><A NAME="233"></A>
<FONT ID="LN">234 </FONT><A NAME="234"></A><FONT ID="FormalComment">/**
<FONT ID="LN">235 </FONT><A NAME="235"></A> * LIR instruction corresponding to the JVM instructions representing string
<FONT ID="LN">236 </FONT><A NAME="236"></A> * constants.
<FONT ID="LN">237 </FONT><A NAME="237"></A> */</FONT>
<FONT ID="LN">238 </FONT><A NAME="238"></A>
<FONT ID="LN">239 </FONT><A NAME="239"></A><FONT ID="Class">class</FONT> NLIRStringConstant <FONT ID="Extends">extends</FONT> <A HREF="../jminusminus/NLIRInstruction.java.html">NLIRInstruction</A> {
<FONT ID="LN">240 </FONT><A NAME="240"></A>
<FONT ID="LN">241 </FONT><A NAME="241"></A>    <FONT ID="FormalComment">/** The constant string value. */</FONT>
<FONT ID="LN">242 </FONT><A NAME="242"></A>    <FONT ID="Public">public</FONT> String value;
<FONT ID="LN">243 </FONT><A NAME="243"></A>
<FONT ID="LN">244 </FONT><A NAME="244"></A>    <FONT ID="FormalComment">/** */</FONT>
<FONT ID="LN">245 </FONT><A NAME="245"></A>    <FONT ID="Private">private</FONT> <FONT ID="Static">static</FONT> <FONT ID="Int">int</FONT> labelSuffix;
<FONT ID="LN">246 </FONT><A NAME="246"></A>
<FONT ID="LN">247 </FONT><A NAME="247"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">248 </FONT><A NAME="248"></A>     * Construct an NHIRStringConstant instruction.
<FONT ID="LN">249 </FONT><A NAME="249"></A>     * 
<FONT ID="LN">250 </FONT><A NAME="250"></A>     * @param block
<FONT ID="LN">251 </FONT><A NAME="251"></A>     *            enclosing block.
<FONT ID="LN">252 </FONT><A NAME="252"></A>     * @param id
<FONT ID="LN">253 </FONT><A NAME="253"></A>     *            identifier for the instruction.
<FONT ID="LN">254 </FONT><A NAME="254"></A>     * @param value
<FONT ID="LN">255 </FONT><A NAME="255"></A>     *            the constant string value.
<FONT ID="LN">256 </FONT><A NAME="256"></A>     */</FONT>
<FONT ID="LN">257 </FONT><A NAME="257"></A>
<FONT ID="LN">258 </FONT><A NAME="258"></A>    <FONT ID="Public">public</FONT> NLIRStringConstant(NBasicBlock block, <FONT ID="Int">int</FONT> id, String value) {
<FONT ID="LN">259 </FONT><A NAME="259"></A>        <FONT ID="Super">super</FONT>(block, id);
<FONT ID="LN">260 </FONT><A NAME="260"></A>        <FONT ID="This">this</FONT>.value = value;
<FONT ID="LN">261 </FONT><A NAME="261"></A>        write = <FONT ID="New">new</FONT> NVirtualRegister(NControlFlowGraph.regId++, <FONT ID="StringLiteral">"L"</FONT>,
<FONT ID="LN">262 </FONT><A NAME="262"></A>                <FONT ID="StringLiteral">"Ljava/lang/String;"</FONT>);
<FONT ID="LN">263 </FONT><A NAME="263"></A>        block.cfg.registers.add((NVirtualRegister) write);
<FONT ID="LN">264 </FONT><A NAME="264"></A>        labelSuffix = <FONT ID="IntegerLiteral">0</FONT>;
<FONT ID="LN">265 </FONT><A NAME="265"></A>    }
<FONT ID="LN">266 </FONT><A NAME="266"></A>
<FONT ID="LN">267 </FONT><A NAME="267"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">268 </FONT><A NAME="268"></A>     * Create a label for LIR code.
<FONT ID="LN">269 </FONT><A NAME="269"></A>     * 
<FONT ID="LN">270 </FONT><A NAME="270"></A>     * @return the Label.
<FONT ID="LN">271 </FONT><A NAME="271"></A>     */</FONT>
<FONT ID="LN">272 </FONT><A NAME="272"></A>
<FONT ID="LN">273 </FONT><A NAME="273"></A>    <FONT ID="Private">private</FONT> String createLabel() {
<FONT ID="LN">274 </FONT><A NAME="274"></A>        <FONT ID="Return">return</FONT> <FONT ID="StringLiteral">"Constant..String"</FONT> + labelSuffix++;
<FONT ID="LN">275 </FONT><A NAME="275"></A>    }
<FONT ID="LN">276 </FONT><A NAME="276"></A>
<FONT ID="LN">277 </FONT><A NAME="277"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">278 </FONT><A NAME="278"></A>     * @inheritDoc
<FONT ID="LN">279 </FONT><A NAME="279"></A>     */</FONT>
<FONT ID="LN">280 </FONT><A NAME="280"></A>
<FONT ID="LN">281 </FONT><A NAME="281"></A>    <FONT ID="Public">public</FONT> <FONT ID="Void">void</FONT> allocatePhysicalRegisters() {
<FONT ID="LN">282 </FONT><A NAME="282"></A>        <A HREF="../jminusminus/NInterval.java.html">NInterval</A> output = block.cfg.intervals.get(write.number()).childAt(id);
<FONT ID="LN">283 </FONT><A NAME="283"></A>        write = output.pRegister;
<FONT ID="LN">284 </FONT><A NAME="284"></A>    }
<FONT ID="LN">285 </FONT><A NAME="285"></A>
<FONT ID="LN">286 </FONT><A NAME="286"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">287 </FONT><A NAME="287"></A>     * @inheritDoc
<FONT ID="LN">288 </FONT><A NAME="288"></A>     */</FONT>
<FONT ID="LN">289 </FONT><A NAME="289"></A>
<FONT ID="LN">290 </FONT><A NAME="290"></A>    <FONT ID="Public">public</FONT> <FONT ID="Void">void</FONT> toSpim(PrintWriter out) {
<FONT ID="LN">291 </FONT><A NAME="291"></A>        String label = createLabel();
<FONT ID="LN">292 </FONT><A NAME="292"></A>        String s = label + <FONT ID="StringLiteral">":\n"</FONT>;
<FONT ID="LN">293 </FONT><A NAME="293"></A>        <FONT ID="Int">int</FONT> size = <FONT ID="IntegerLiteral">12</FONT> + value.length() + <FONT ID="IntegerLiteral">1</FONT>;
<FONT ID="LN">294 </FONT><A NAME="294"></A>        <FONT ID="Int">int</FONT> align = (size % <FONT ID="IntegerLiteral">4</FONT> == <FONT ID="IntegerLiteral">0</FONT>) ? <FONT ID="IntegerLiteral">0</FONT> : (size + <FONT ID="IntegerLiteral">4</FONT>) / <FONT ID="IntegerLiteral">4</FONT> * <FONT ID="IntegerLiteral">4</FONT> - size;
<FONT ID="LN">295 </FONT><A NAME="295"></A>        s += <FONT ID="StringLiteral">"    .word 2 # Tag 2 indicates a string\n"</FONT>;
<FONT ID="LN">296 </FONT><A NAME="296"></A>        s += <FONT ID="StringLiteral">"    .word "</FONT> + (size + align) + <FONT ID="StringLiteral">" # Size of object in bytes\n"</FONT>;
<FONT ID="LN">297 </FONT><A NAME="297"></A>        s += <FONT ID="StringLiteral">"    .word "</FONT> + value.length()
<FONT ID="LN">298 </FONT><A NAME="298"></A>                + <FONT ID="StringLiteral">" # String length (not including null terminator)\n"</FONT>;
<FONT ID="LN">299 </FONT><A NAME="299"></A>        s += <FONT ID="StringLiteral">"    .asciiz \""</FONT> + value
<FONT ID="LN">300 </FONT><A NAME="300"></A>                + <FONT ID="StringLiteral">"\" # String terminated by null character 0\n"</FONT>;
<FONT ID="LN">301 </FONT><A NAME="301"></A>        s += <FONT ID="StringLiteral">"    .align "</FONT> + align + <FONT ID="StringLiteral">" # Next object is on a word boundary\n"</FONT>;
<FONT ID="LN">302 </FONT><A NAME="302"></A>        block.cfg.data.add(s);
<FONT ID="LN">303 </FONT><A NAME="303"></A>        out.printf(<FONT ID="StringLiteral">"    la %s,%s+12\n"</FONT>, write, label);
<FONT ID="LN">304 </FONT><A NAME="304"></A>    }
<FONT ID="LN">305 </FONT><A NAME="305"></A>
<FONT ID="LN">306 </FONT><A NAME="306"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">307 </FONT><A NAME="307"></A>     * @inheritDoc
<FONT ID="LN">308 </FONT><A NAME="308"></A>     */</FONT>
<FONT ID="LN">309 </FONT><A NAME="309"></A>
<FONT ID="LN">310 </FONT><A NAME="310"></A>    <FONT ID="Public">public</FONT> String toString() {
<FONT ID="LN">311 </FONT><A NAME="311"></A>        <FONT ID="Return">return</FONT> id + <FONT ID="StringLiteral">": LDC ["</FONT> + value + <FONT ID="StringLiteral">"] "</FONT> + write;
<FONT ID="LN">312 </FONT><A NAME="312"></A>    }
<FONT ID="LN">313 </FONT><A NAME="313"></A>
<FONT ID="LN">314 </FONT><A NAME="314"></A>}
<FONT ID="LN">315 </FONT><A NAME="315"></A>
<FONT ID="LN">316 </FONT><A NAME="316"></A><FONT ID="FormalComment">/**
<FONT ID="LN">317 </FONT><A NAME="317"></A> * LIR instruction representing an conditional jump instructions in JVM.
<FONT ID="LN">318 </FONT><A NAME="318"></A> */</FONT>
<FONT ID="LN">319 </FONT><A NAME="319"></A>
<FONT ID="LN">320 </FONT><A NAME="320"></A><FONT ID="Class">class</FONT> NLIRConditionalJump <FONT ID="Extends">extends</FONT> <A HREF="../jminusminus/NLIRInstruction.java.html">NLIRInstruction</A> {
<FONT ID="LN">321 </FONT><A NAME="321"></A>
<FONT ID="LN">322 </FONT><A NAME="322"></A>    <FONT ID="FormalComment">/** Test expression opcode. */</FONT>
<FONT ID="LN">323 </FONT><A NAME="323"></A>    <FONT ID="Public">public</FONT> <FONT ID="Int">int</FONT> opcode;
<FONT ID="LN">324 </FONT><A NAME="324"></A>
<FONT ID="LN">325 </FONT><A NAME="325"></A>    <FONT ID="FormalComment">/** Block to jump to on true. */</FONT>
<FONT ID="LN">326 </FONT><A NAME="326"></A>    <FONT ID="Public">public</FONT> NBasicBlock onTrueDestination;
<FONT ID="LN">327 </FONT><A NAME="327"></A>
<FONT ID="LN">328 </FONT><A NAME="328"></A>    <FONT ID="FormalComment">/** Block to jump to on false. */</FONT>
<FONT ID="LN">329 </FONT><A NAME="329"></A>    <FONT ID="Public">public</FONT> NBasicBlock onFalseDestination;
<FONT ID="LN">330 </FONT><A NAME="330"></A>
<FONT ID="LN">331 </FONT><A NAME="331"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">332 </FONT><A NAME="332"></A>     * Construct an NLIRConditionalJump instruction.
<FONT ID="LN">333 </FONT><A NAME="333"></A>     * 
<FONT ID="LN">334 </FONT><A NAME="334"></A>     * @param block
<FONT ID="LN">335 </FONT><A NAME="335"></A>     *            enclosing block.
<FONT ID="LN">336 </FONT><A NAME="336"></A>     * @param id
<FONT ID="LN">337 </FONT><A NAME="337"></A>     *            identifier of the instruction.
<FONT ID="LN">338 </FONT><A NAME="338"></A>     * @param lhs
<FONT ID="LN">339 </FONT><A NAME="339"></A>     *            lhs LIR.
<FONT ID="LN">340 </FONT><A NAME="340"></A>     * @param rhs
<FONT ID="LN">341 </FONT><A NAME="341"></A>     *            rhs LIR.
<FONT ID="LN">342 </FONT><A NAME="342"></A>     * @param opcode
<FONT ID="LN">343 </FONT><A NAME="343"></A>     *            opcode in the test.
<FONT ID="LN">344 </FONT><A NAME="344"></A>     * @param onTrueDestination
<FONT ID="LN">345 </FONT><A NAME="345"></A>     *            block to jump to on true.
<FONT ID="LN">346 </FONT><A NAME="346"></A>     * @param onFalseDestination
<FONT ID="LN">347 </FONT><A NAME="347"></A>     *            block to jump to on false.
<FONT ID="LN">348 </FONT><A NAME="348"></A>     */</FONT>
<FONT ID="LN">349 </FONT><A NAME="349"></A>
<FONT ID="LN">350 </FONT><A NAME="350"></A>    <FONT ID="Public">public</FONT> NLIRConditionalJump(NBasicBlock block, <FONT ID="Int">int</FONT> id, <A HREF="../jminusminus/NLIRInstruction.java.html">NLIRInstruction</A> lhs,
<FONT ID="LN">351 </FONT><A NAME="351"></A>            <A HREF="../jminusminus/NLIRInstruction.java.html">NLIRInstruction</A> rhs, <FONT ID="Int">int</FONT> opcode, NBasicBlock onTrueDestination,
<FONT ID="LN">352 </FONT><A NAME="352"></A>            NBasicBlock onFalseDestination) {
<FONT ID="LN">353 </FONT><A NAME="353"></A>        <FONT ID="Super">super</FONT>(block, id);
<FONT ID="LN">354 </FONT><A NAME="354"></A>        <FONT ID="This">this</FONT>.opcode = opcode;
<FONT ID="LN">355 </FONT><A NAME="355"></A>        reads.add(lhs.write);
<FONT ID="LN">356 </FONT><A NAME="356"></A>        reads.add(rhs.write);
<FONT ID="LN">357 </FONT><A NAME="357"></A>        <FONT ID="This">this</FONT>.onTrueDestination = onTrueDestination;
<FONT ID="LN">358 </FONT><A NAME="358"></A>        <FONT ID="This">this</FONT>.onFalseDestination = onFalseDestination;
<FONT ID="LN">359 </FONT><A NAME="359"></A>    }
<FONT ID="LN">360 </FONT><A NAME="360"></A>
<FONT ID="LN">361 </FONT><A NAME="361"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">362 </FONT><A NAME="362"></A>     * @inheritDoc
<FONT ID="LN">363 </FONT><A NAME="363"></A>     */</FONT>
<FONT ID="LN">364 </FONT><A NAME="364"></A>
<FONT ID="LN">365 </FONT><A NAME="365"></A>    <FONT ID="Public">public</FONT> <FONT ID="Void">void</FONT> allocatePhysicalRegisters() {
<FONT ID="LN">366 </FONT><A NAME="366"></A>        <A HREF="../jminusminus/NInterval.java.html">NInterval</A> input1 = block.cfg.intervals.get(reads.get(<FONT ID="IntegerLiteral">0</FONT>).number())
<FONT ID="LN">367 </FONT><A NAME="367"></A>                .childAt(id);
<FONT ID="LN">368 </FONT><A NAME="368"></A>        <A HREF="../jminusminus/NInterval.java.html">NInterval</A> input2 = block.cfg.intervals.get(reads.get(<FONT ID="IntegerLiteral">1</FONT>).number())
<FONT ID="LN">369 </FONT><A NAME="369"></A>                .childAt(id);
<FONT ID="LN">370 </FONT><A NAME="370"></A>        reads.set(<FONT ID="IntegerLiteral">0</FONT>, input1.pRegister);
<FONT ID="LN">371 </FONT><A NAME="371"></A>        reads.set(<FONT ID="IntegerLiteral">1</FONT>, input2.pRegister);
<FONT ID="LN">372 </FONT><A NAME="372"></A>    }
<FONT ID="LN">373 </FONT><A NAME="373"></A>
<FONT ID="LN">374 </FONT><A NAME="374"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">375 </FONT><A NAME="375"></A>     * @inheritDoc
<FONT ID="LN">376 </FONT><A NAME="376"></A>     */</FONT>
<FONT ID="LN">377 </FONT><A NAME="377"></A>
<FONT ID="LN">378 </FONT><A NAME="378"></A>    <FONT ID="Public">public</FONT> <FONT ID="Void">void</FONT> toSpim(PrintWriter out) {
<FONT ID="LN">379 </FONT><A NAME="379"></A>        <FONT ID="Switch">switch</FONT> (opcode) {
<FONT ID="LN">380 </FONT><A NAME="380"></A>        <FONT ID="Case">case</FONT> IF_ICMPNE:
<FONT ID="LN">381 </FONT><A NAME="381"></A>            out.printf(<FONT ID="StringLiteral">"    bne %s,%s,%s\n"</FONT>, reads.get(<FONT ID="IntegerLiteral">0</FONT>), reads.get(<FONT ID="IntegerLiteral">1</FONT>),
<FONT ID="LN">382 </FONT><A NAME="382"></A>                    block.cfg.labelPrefix + <FONT ID="StringLiteral">"."</FONT> + onTrueDestination.id);
<FONT ID="LN">383 </FONT><A NAME="383"></A>            <FONT ID="Break">break</FONT>;
<FONT ID="LN">384 </FONT><A NAME="384"></A>        <FONT ID="Case">case</FONT> IF_ICMPGT:
<FONT ID="LN">385 </FONT><A NAME="385"></A>            out.printf(<FONT ID="StringLiteral">"    bgt %s,%s,%s\n"</FONT>, reads.get(<FONT ID="IntegerLiteral">0</FONT>), reads.get(<FONT ID="IntegerLiteral">1</FONT>),
<FONT ID="LN">386 </FONT><A NAME="386"></A>                    block.cfg.labelPrefix + <FONT ID="StringLiteral">"."</FONT> + onTrueDestination.id);
<FONT ID="LN">387 </FONT><A NAME="387"></A>            <FONT ID="Break">break</FONT>;
<FONT ID="LN">388 </FONT><A NAME="388"></A>        <FONT ID="Case">case</FONT> IF_ICMPLE:
<FONT ID="LN">389 </FONT><A NAME="389"></A>            out.printf(<FONT ID="StringLiteral">"    ble %s,%s,%s\n"</FONT>, reads.get(<FONT ID="IntegerLiteral">0</FONT>), reads.get(<FONT ID="IntegerLiteral">1</FONT>),
<FONT ID="LN">390 </FONT><A NAME="390"></A>                    block.cfg.labelPrefix + <FONT ID="StringLiteral">"."</FONT> + onTrueDestination.id);
<FONT ID="LN">391 </FONT><A NAME="391"></A>            <FONT ID="Break">break</FONT>;
<FONT ID="LN">392 </FONT><A NAME="392"></A>        }
<FONT ID="LN">393 </FONT><A NAME="393"></A>        out.printf(<FONT ID="StringLiteral">"    j %s\n"</FONT>, block.cfg.labelPrefix + <FONT ID="StringLiteral">"."</FONT>
<FONT ID="LN">394 </FONT><A NAME="394"></A>                + onFalseDestination.id);
<FONT ID="LN">395 </FONT><A NAME="395"></A>    }
<FONT ID="LN">396 </FONT><A NAME="396"></A>
<FONT ID="LN">397 </FONT><A NAME="397"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">398 </FONT><A NAME="398"></A>     * @inheritDoc
<FONT ID="LN">399 </FONT><A NAME="399"></A>     */</FONT>
<FONT ID="LN">400 </FONT><A NAME="400"></A>
<FONT ID="LN">401 </FONT><A NAME="401"></A>    <FONT ID="Public">public</FONT> String toString() {
<FONT ID="LN">402 </FONT><A NAME="402"></A>        <FONT ID="Return">return</FONT> id + <FONT ID="StringLiteral">": BRANCH ["</FONT> + lirMnemonic[opcode] + <FONT ID="StringLiteral">"] "</FONT> + reads.get(<FONT ID="IntegerLiteral">0</FONT>)
<FONT ID="LN">403 </FONT><A NAME="403"></A>                + <FONT ID="StringLiteral">" "</FONT> + reads.get(<FONT ID="IntegerLiteral">1</FONT>) + <FONT ID="StringLiteral">" "</FONT> + onTrueDestination.id();
<FONT ID="LN">404 </FONT><A NAME="404"></A>    }
<FONT ID="LN">405 </FONT><A NAME="405"></A>
<FONT ID="LN">406 </FONT><A NAME="406"></A>}
<FONT ID="LN">407 </FONT><A NAME="407"></A>
<FONT ID="LN">408 </FONT><A NAME="408"></A><FONT ID="FormalComment">/**
<FONT ID="LN">409 </FONT><A NAME="409"></A> * LIR instruction representing an unconditional jump instruction in JVM.
<FONT ID="LN">410 </FONT><A NAME="410"></A> */</FONT>
<FONT ID="LN">411 </FONT><A NAME="411"></A>
<FONT ID="LN">412 </FONT><A NAME="412"></A><FONT ID="Class">class</FONT> NLIRGoto <FONT ID="Extends">extends</FONT> <A HREF="../jminusminus/NLIRInstruction.java.html">NLIRInstruction</A> {
<FONT ID="LN">413 </FONT><A NAME="413"></A>
<FONT ID="LN">414 </FONT><A NAME="414"></A>    <FONT ID="FormalComment">/** The destination block to unconditionally jump to. */</FONT>
<FONT ID="LN">415 </FONT><A NAME="415"></A>    <FONT ID="Private">private</FONT> NBasicBlock destination;
<FONT ID="LN">416 </FONT><A NAME="416"></A>
<FONT ID="LN">417 </FONT><A NAME="417"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">418 </FONT><A NAME="418"></A>     * Construct an NLIRGoto instruction.
<FONT ID="LN">419 </FONT><A NAME="419"></A>     * 
<FONT ID="LN">420 </FONT><A NAME="420"></A>     * @param block
<FONT ID="LN">421 </FONT><A NAME="421"></A>     *            enclosing block.
<FONT ID="LN">422 </FONT><A NAME="422"></A>     * @param id
<FONT ID="LN">423 </FONT><A NAME="423"></A>     *            identifier of the instruction.
<FONT ID="LN">424 </FONT><A NAME="424"></A>     * @param destination
<FONT ID="LN">425 </FONT><A NAME="425"></A>     *            the block to jump to.
<FONT ID="LN">426 </FONT><A NAME="426"></A>     */</FONT>
<FONT ID="LN">427 </FONT><A NAME="427"></A>
<FONT ID="LN">428 </FONT><A NAME="428"></A>    <FONT ID="Public">public</FONT> NLIRGoto(NBasicBlock block, <FONT ID="Int">int</FONT> id, NBasicBlock destination) {
<FONT ID="LN">429 </FONT><A NAME="429"></A>        <FONT ID="Super">super</FONT>(block, id);
<FONT ID="LN">430 </FONT><A NAME="430"></A>        <FONT ID="This">this</FONT>.destination = destination;
<FONT ID="LN">431 </FONT><A NAME="431"></A>    }
<FONT ID="LN">432 </FONT><A NAME="432"></A>
<FONT ID="LN">433 </FONT><A NAME="433"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">434 </FONT><A NAME="434"></A>     * @inheritDoc
<FONT ID="LN">435 </FONT><A NAME="435"></A>     */</FONT>
<FONT ID="LN">436 </FONT><A NAME="436"></A>
<FONT ID="LN">437 </FONT><A NAME="437"></A>    <FONT ID="Public">public</FONT> <FONT ID="Void">void</FONT> toSpim(PrintWriter out) {
<FONT ID="LN">438 </FONT><A NAME="438"></A>        String label = block.cfg.labelPrefix + <FONT ID="StringLiteral">"."</FONT> + destination.id;
<FONT ID="LN">439 </FONT><A NAME="439"></A>        out.printf(<FONT ID="StringLiteral">"    j %s\n"</FONT>, label);
<FONT ID="LN">440 </FONT><A NAME="440"></A>    }
<FONT ID="LN">441 </FONT><A NAME="441"></A>
<FONT ID="LN">442 </FONT><A NAME="442"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">443 </FONT><A NAME="443"></A>     * @inheritDoc
<FONT ID="LN">444 </FONT><A NAME="444"></A>     */</FONT>
<FONT ID="LN">445 </FONT><A NAME="445"></A>
<FONT ID="LN">446 </FONT><A NAME="446"></A>    <FONT ID="Public">public</FONT> String toString() {
<FONT ID="LN">447 </FONT><A NAME="447"></A>        <FONT ID="Return">return</FONT> id + <FONT ID="StringLiteral">": BRANCH "</FONT> + destination.id();
<FONT ID="LN">448 </FONT><A NAME="448"></A>    }
<FONT ID="LN">449 </FONT><A NAME="449"></A>
<FONT ID="LN">450 </FONT><A NAME="450"></A>}
<FONT ID="LN">451 </FONT><A NAME="451"></A>
<FONT ID="LN">452 </FONT><A NAME="452"></A><FONT ID="FormalComment">/**
<FONT ID="LN">453 </FONT><A NAME="453"></A> * LIR instruction representing method invocation instructions in JVM.
<FONT ID="LN">454 </FONT><A NAME="454"></A> */</FONT>
<FONT ID="LN">455 </FONT><A NAME="455"></A>
<FONT ID="LN">456 </FONT><A NAME="456"></A><FONT ID="Class">class</FONT> NLIRInvoke <FONT ID="Extends">extends</FONT> <A HREF="../jminusminus/NLIRInstruction.java.html">NLIRInstruction</A> {
<FONT ID="LN">457 </FONT><A NAME="457"></A>
<FONT ID="LN">458 </FONT><A NAME="458"></A>    <FONT ID="FormalComment">/** Opcode of the JVM instruction. */</FONT>
<FONT ID="LN">459 </FONT><A NAME="459"></A>    <FONT ID="Public">public</FONT> <FONT ID="Int">int</FONT> opcode;
<FONT ID="LN">460 </FONT><A NAME="460"></A>
<FONT ID="LN">461 </FONT><A NAME="461"></A>    <FONT ID="FormalComment">/** Target for the method. */</FONT>
<FONT ID="LN">462 </FONT><A NAME="462"></A>    <FONT ID="Public">public</FONT> String target;
<FONT ID="LN">463 </FONT><A NAME="463"></A>
<FONT ID="LN">464 </FONT><A NAME="464"></A>    <FONT ID="FormalComment">/** Name of the method being invoked. */</FONT>
<FONT ID="LN">465 </FONT><A NAME="465"></A>    <FONT ID="Public">public</FONT> String name;
<FONT ID="LN">466 </FONT><A NAME="466"></A>
<FONT ID="LN">467 </FONT><A NAME="467"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">468 </FONT><A NAME="468"></A>     * Construct an NHIRInvoke instruction.
<FONT ID="LN">469 </FONT><A NAME="469"></A>     * 
<FONT ID="LN">470 </FONT><A NAME="470"></A>     * @param block
<FONT ID="LN">471 </FONT><A NAME="471"></A>     *            enclosing block.
<FONT ID="LN">472 </FONT><A NAME="472"></A>     * @param id
<FONT ID="LN">473 </FONT><A NAME="473"></A>     *            identifier of the instruction.
<FONT ID="LN">474 </FONT><A NAME="474"></A>     * @param opcode
<FONT ID="LN">475 </FONT><A NAME="475"></A>     *            opcode of the JVM instruction.
<FONT ID="LN">476 </FONT><A NAME="476"></A>     * @param target
<FONT ID="LN">477 </FONT><A NAME="477"></A>     *            target of the method.
<FONT ID="LN">478 </FONT><A NAME="478"></A>     * @param name
<FONT ID="LN">479 </FONT><A NAME="479"></A>     *            name of the method.
<FONT ID="LN">480 </FONT><A NAME="480"></A>     * @param arguments
<FONT ID="LN">481 </FONT><A NAME="481"></A>     *            list of register storing the of arguments for the method.
<FONT ID="LN">482 </FONT><A NAME="482"></A>     * @param sType
<FONT ID="LN">483 </FONT><A NAME="483"></A>     *            return type (short name) of the method.
<FONT ID="LN">484 </FONT><A NAME="484"></A>     * @param lType
<FONT ID="LN">485 </FONT><A NAME="485"></A>     *            return type (long name) of the method.
<FONT ID="LN">486 </FONT><A NAME="486"></A>     */</FONT>
<FONT ID="LN">487 </FONT><A NAME="487"></A>
<FONT ID="LN">488 </FONT><A NAME="488"></A>    <FONT ID="Public">public</FONT> NLIRInvoke(NBasicBlock block, <FONT ID="Int">int</FONT> id, <FONT ID="Int">int</FONT> opcode, String target,
<FONT ID="LN">489 </FONT><A NAME="489"></A>            String name, ArrayList&lt;<A HREF="../jminusminus/NRegister.java.html">NRegister</A>&gt; arguments, String sType,
<FONT ID="LN">490 </FONT><A NAME="490"></A>            String lType) {
<FONT ID="LN">491 </FONT><A NAME="491"></A>        <FONT ID="Super">super</FONT>(block, id);
<FONT ID="LN">492 </FONT><A NAME="492"></A>        <FONT ID="This">this</FONT>.opcode = opcode;
<FONT ID="LN">493 </FONT><A NAME="493"></A>        <FONT ID="This">this</FONT>.target = target;
<FONT ID="LN">494 </FONT><A NAME="494"></A>        <FONT ID="This">this</FONT>.name = name;
<FONT ID="LN">495 </FONT><A NAME="495"></A>        <FONT ID="For">for</FONT> (<A HREF="../jminusminus/NRegister.java.html">NRegister</A> arg : arguments) {
<FONT ID="LN">496 </FONT><A NAME="496"></A>            reads.add(arg);
<FONT ID="LN">497 </FONT><A NAME="497"></A>        }
<FONT ID="LN">498 </FONT><A NAME="498"></A>        <FONT ID="If">if</FONT> (!sType.equals(<FONT ID="StringLiteral">"V"</FONT>)) {
<FONT ID="LN">499 </FONT><A NAME="499"></A>            write = NPhysicalRegister.regInfo[V0];
<FONT ID="LN">500 </FONT><A NAME="500"></A>            block.cfg.registers.set(V0, write);
<FONT ID="LN">501 </FONT><A NAME="501"></A>        }
<FONT ID="LN">502 </FONT><A NAME="502"></A>    }
<FONT ID="LN">503 </FONT><A NAME="503"></A>
<FONT ID="LN">504 </FONT><A NAME="504"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">505 </FONT><A NAME="505"></A>     * @inheritDoc
<FONT ID="LN">506 </FONT><A NAME="506"></A>     */</FONT>
<FONT ID="LN">507 </FONT><A NAME="507"></A>
<FONT ID="LN">508 </FONT><A NAME="508"></A>    <FONT ID="Public">public</FONT> <FONT ID="Void">void</FONT> allocatePhysicalRegisters() {
<FONT ID="LN">509 </FONT><A NAME="509"></A>        <FONT ID="For">for</FONT> (<FONT ID="Int">int</FONT> i = <FONT ID="IntegerLiteral">0</FONT>; i &lt; reads.size(); i++) {
<FONT ID="LN">510 </FONT><A NAME="510"></A>            <A HREF="../jminusminus/NInterval.java.html">NInterval</A> input = block.cfg.intervals.get(reads.get(i).number())
<FONT ID="LN">511 </FONT><A NAME="511"></A>                    .childAt(id);
<FONT ID="LN">512 </FONT><A NAME="512"></A>            reads.set(i, input.pRegister);
<FONT ID="LN">513 </FONT><A NAME="513"></A>        }
<FONT ID="LN">514 </FONT><A NAME="514"></A>    }
<FONT ID="LN">515 </FONT><A NAME="515"></A>
<FONT ID="LN">516 </FONT><A NAME="516"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">517 </FONT><A NAME="517"></A>     * @inheritDoc
<FONT ID="LN">518 </FONT><A NAME="518"></A>     */</FONT>
<FONT ID="LN">519 </FONT><A NAME="519"></A>
<FONT ID="LN">520 </FONT><A NAME="520"></A>    <FONT ID="Public">public</FONT> <FONT ID="Void">void</FONT> toSpim(PrintWriter out) {
<FONT ID="LN">521 </FONT><A NAME="521"></A>        out.printf(<FONT ID="StringLiteral">"    jal %s.%s\n"</FONT>, target.replace(<FONT ID="StringLiteral">"/"</FONT>, <FONT ID="StringLiteral">"."</FONT>), name
<FONT ID="LN">522 </FONT><A NAME="522"></A>                .equals(<FONT ID="StringLiteral">"&lt;init&gt;"</FONT>) ? <FONT ID="StringLiteral">"__init__"</FONT> : name);
<FONT ID="LN">523 </FONT><A NAME="523"></A>    }
<FONT ID="LN">524 </FONT><A NAME="524"></A>
<FONT ID="LN">525 </FONT><A NAME="525"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">526 </FONT><A NAME="526"></A>     * @inheritDoc
<FONT ID="LN">527 </FONT><A NAME="527"></A>     */</FONT>
<FONT ID="LN">528 </FONT><A NAME="528"></A>
<FONT ID="LN">529 </FONT><A NAME="529"></A>    <FONT ID="Public">public</FONT> String toString() {
<FONT ID="LN">530 </FONT><A NAME="530"></A>        String s = id + <FONT ID="StringLiteral">": "</FONT> + lirMnemonic[opcode] + <FONT ID="StringLiteral">" "</FONT>
<FONT ID="LN">531 </FONT><A NAME="531"></A>                + (write != <FONT ID="Null">null</FONT> ? write + <FONT ID="StringLiteral">" = "</FONT> : <FONT ID="StringLiteral">""</FONT>) + target + <FONT ID="StringLiteral">"."</FONT> + name
<FONT ID="LN">532 </FONT><A NAME="532"></A>                + <FONT ID="StringLiteral">"( "</FONT>;
<FONT ID="LN">533 </FONT><A NAME="533"></A>        <FONT ID="For">for</FONT> (<A HREF="../jminusminus/NRegister.java.html">NRegister</A> input : reads) {
<FONT ID="LN">534 </FONT><A NAME="534"></A>            s += input + <FONT ID="StringLiteral">" "</FONT>;
<FONT ID="LN">535 </FONT><A NAME="535"></A>        }
<FONT ID="LN">536 </FONT><A NAME="536"></A>        s += <FONT ID="StringLiteral">")"</FONT>;
<FONT ID="LN">537 </FONT><A NAME="537"></A>        <FONT ID="Return">return</FONT> s;
<FONT ID="LN">538 </FONT><A NAME="538"></A>    }
<FONT ID="LN">539 </FONT><A NAME="539"></A>
<FONT ID="LN">540 </FONT><A NAME="540"></A>}
<FONT ID="LN">541 </FONT><A NAME="541"></A>
<FONT ID="LN">542 </FONT><A NAME="542"></A><FONT ID="FormalComment">/**
<FONT ID="LN">543 </FONT><A NAME="543"></A> * HIR instruction representing a JVM return instruction.
<FONT ID="LN">544 </FONT><A NAME="544"></A> */</FONT>
<FONT ID="LN">545 </FONT><A NAME="545"></A>
<FONT ID="LN">546 </FONT><A NAME="546"></A><FONT ID="Class">class</FONT> NLIRReturn <FONT ID="Extends">extends</FONT> <A HREF="../jminusminus/NLIRInstruction.java.html">NLIRInstruction</A> {
<FONT ID="LN">547 </FONT><A NAME="547"></A>
<FONT ID="LN">548 </FONT><A NAME="548"></A>    <FONT ID="FormalComment">/** JVM opcode for the return instruction. */</FONT>
<FONT ID="LN">549 </FONT><A NAME="549"></A>    <FONT ID="Public">public</FONT> <FONT ID="Int">int</FONT> opcode;
<FONT ID="LN">550 </FONT><A NAME="550"></A>
<FONT ID="LN">551 </FONT><A NAME="551"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">552 </FONT><A NAME="552"></A>     * Construct an NLIRReturn instruction.
<FONT ID="LN">553 </FONT><A NAME="553"></A>     * 
<FONT ID="LN">554 </FONT><A NAME="554"></A>     * @param block
<FONT ID="LN">555 </FONT><A NAME="555"></A>     *            enclosing block.
<FONT ID="LN">556 </FONT><A NAME="556"></A>     * @param id
<FONT ID="LN">557 </FONT><A NAME="557"></A>     *            identifier of the instruction.
<FONT ID="LN">558 </FONT><A NAME="558"></A>     * @param opcode
<FONT ID="LN">559 </FONT><A NAME="559"></A>     *            JVM opcode for the return instruction.
<FONT ID="LN">560 </FONT><A NAME="560"></A>     * @param result
<FONT ID="LN">561 </FONT><A NAME="561"></A>     *            physical register storing return value, or null.
<FONT ID="LN">562 </FONT><A NAME="562"></A>     */</FONT>
<FONT ID="LN">563 </FONT><A NAME="563"></A>
<FONT ID="LN">564 </FONT><A NAME="564"></A>    <FONT ID="Public">public</FONT> NLIRReturn(NBasicBlock block, <FONT ID="Int">int</FONT> id, <FONT ID="Int">int</FONT> opcode,
<FONT ID="LN">565 </FONT><A NAME="565"></A>            NPhysicalRegister result) {
<FONT ID="LN">566 </FONT><A NAME="566"></A>        <FONT ID="Super">super</FONT>(block, id);
<FONT ID="LN">567 </FONT><A NAME="567"></A>        <FONT ID="This">this</FONT>.opcode = opcode;
<FONT ID="LN">568 </FONT><A NAME="568"></A>        <FONT ID="If">if</FONT> (result != <FONT ID="Null">null</FONT>) {
<FONT ID="LN">569 </FONT><A NAME="569"></A>            reads.add(result);
<FONT ID="LN">570 </FONT><A NAME="570"></A>        }
<FONT ID="LN">571 </FONT><A NAME="571"></A>    }
<FONT ID="LN">572 </FONT><A NAME="572"></A>
<FONT ID="LN">573 </FONT><A NAME="573"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">574 </FONT><A NAME="574"></A>     * @inheritDoc
<FONT ID="LN">575 </FONT><A NAME="575"></A>     */</FONT>
<FONT ID="LN">576 </FONT><A NAME="576"></A>
<FONT ID="LN">577 </FONT><A NAME="577"></A>    <FONT ID="Public">public</FONT> <FONT ID="Void">void</FONT> toSpim(PrintWriter out) {
<FONT ID="LN">578 </FONT><A NAME="578"></A>        out.printf(<FONT ID="StringLiteral">"    j %s\n"</FONT>, block.cfg.labelPrefix + <FONT ID="StringLiteral">".restore"</FONT>);
<FONT ID="LN">579 </FONT><A NAME="579"></A>    }
<FONT ID="LN">580 </FONT><A NAME="580"></A>
<FONT ID="LN">581 </FONT><A NAME="581"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">582 </FONT><A NAME="582"></A>     * @inheritDoc
<FONT ID="LN">583 </FONT><A NAME="583"></A>     */</FONT>
<FONT ID="LN">584 </FONT><A NAME="584"></A>
<FONT ID="LN">585 </FONT><A NAME="585"></A>    <FONT ID="Public">public</FONT> String toString() {
<FONT ID="LN">586 </FONT><A NAME="586"></A>        <FONT ID="If">if</FONT> (reads.size() == <FONT ID="IntegerLiteral">0</FONT>) {
<FONT ID="LN">587 </FONT><A NAME="587"></A>            <FONT ID="Return">return</FONT> id + <FONT ID="StringLiteral">": RETURN"</FONT>;
<FONT ID="LN">588 </FONT><A NAME="588"></A>        }
<FONT ID="LN">589 </FONT><A NAME="589"></A>        <FONT ID="Return">return</FONT> id + <FONT ID="StringLiteral">": RETURN "</FONT> + reads.get(<FONT ID="IntegerLiteral">0</FONT>);
<FONT ID="LN">590 </FONT><A NAME="590"></A>    }
<FONT ID="LN">591 </FONT><A NAME="591"></A>
<FONT ID="LN">592 </FONT><A NAME="592"></A>}
<FONT ID="LN">593 </FONT><A NAME="593"></A>
<FONT ID="LN">594 </FONT><A NAME="594"></A><FONT ID="FormalComment">/**
<FONT ID="LN">595 </FONT><A NAME="595"></A> * LIR instruction representing JVM (put) field instructions.
<FONT ID="LN">596 </FONT><A NAME="596"></A> */</FONT>
<FONT ID="LN">597 </FONT><A NAME="597"></A>
<FONT ID="LN">598 </FONT><A NAME="598"></A><FONT ID="Class">class</FONT> NLIRPutField <FONT ID="Extends">extends</FONT> <A HREF="../jminusminus/NLIRInstruction.java.html">NLIRInstruction</A> {
<FONT ID="LN">599 </FONT><A NAME="599"></A>
<FONT ID="LN">600 </FONT><A NAME="600"></A>    <FONT ID="FormalComment">/** Opcode of the JVM instruction. */</FONT>
<FONT ID="LN">601 </FONT><A NAME="601"></A>    <FONT ID="Public">public</FONT> <FONT ID="Int">int</FONT> opcode;
<FONT ID="LN">602 </FONT><A NAME="602"></A>
<FONT ID="LN">603 </FONT><A NAME="603"></A>    <FONT ID="FormalComment">/** Target for the field. */</FONT>
<FONT ID="LN">604 </FONT><A NAME="604"></A>    <FONT ID="Public">public</FONT> String target;
<FONT ID="LN">605 </FONT><A NAME="605"></A>
<FONT ID="LN">606 </FONT><A NAME="606"></A>    <FONT ID="FormalComment">/** Name of the field being accessed. */</FONT>
<FONT ID="LN">607 </FONT><A NAME="607"></A>    <FONT ID="Public">public</FONT> String name;
<FONT ID="LN">608 </FONT><A NAME="608"></A>
<FONT ID="LN">609 </FONT><A NAME="609"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">610 </FONT><A NAME="610"></A>     * Construct an NLIRPutField instruction.
<FONT ID="LN">611 </FONT><A NAME="611"></A>     * 
<FONT ID="LN">612 </FONT><A NAME="612"></A>     * @param block
<FONT ID="LN">613 </FONT><A NAME="613"></A>     *            enclosing block.
<FONT ID="LN">614 </FONT><A NAME="614"></A>     * @param id
<FONT ID="LN">615 </FONT><A NAME="615"></A>     *            identifier of the instruction.
<FONT ID="LN">616 </FONT><A NAME="616"></A>     * @param opcode
<FONT ID="LN">617 </FONT><A NAME="617"></A>     *            JVM opcode for the return instruction.
<FONT ID="LN">618 </FONT><A NAME="618"></A>     * @param target
<FONT ID="LN">619 </FONT><A NAME="619"></A>     *            target for the field.
<FONT ID="LN">620 </FONT><A NAME="620"></A>     * @param name
<FONT ID="LN">621 </FONT><A NAME="621"></A>     *            name of the field.
<FONT ID="LN">622 </FONT><A NAME="622"></A>     * @param sType
<FONT ID="LN">623 </FONT><A NAME="623"></A>     *            type (short name) of the field.
<FONT ID="LN">624 </FONT><A NAME="624"></A>     * @param lType
<FONT ID="LN">625 </FONT><A NAME="625"></A>     *            type (long name) of the field.
<FONT ID="LN">626 </FONT><A NAME="626"></A>     * @param value
<FONT ID="LN">627 </FONT><A NAME="627"></A>     *            LIR of the value of the field.
<FONT ID="LN">628 </FONT><A NAME="628"></A>     */</FONT>
<FONT ID="LN">629 </FONT><A NAME="629"></A>
<FONT ID="LN">630 </FONT><A NAME="630"></A>    <FONT ID="Public">public</FONT> NLIRPutField(NBasicBlock block, <FONT ID="Int">int</FONT> id, <FONT ID="Int">int</FONT> opcode, String target,
<FONT ID="LN">631 </FONT><A NAME="631"></A>            String name, String sType, String lType, <A HREF="../jminusminus/NLIRInstruction.java.html">NLIRInstruction</A> value) {
<FONT ID="LN">632 </FONT><A NAME="632"></A>        <FONT ID="Super">super</FONT>(block, id);
<FONT ID="LN">633 </FONT><A NAME="633"></A>        <FONT ID="This">this</FONT>.opcode = opcode;
<FONT ID="LN">634 </FONT><A NAME="634"></A>        <FONT ID="This">this</FONT>.target = target;
<FONT ID="LN">635 </FONT><A NAME="635"></A>        <FONT ID="This">this</FONT>.name = name;
<FONT ID="LN">636 </FONT><A NAME="636"></A>        reads.add(value.write);
<FONT ID="LN">637 </FONT><A NAME="637"></A>    }
<FONT ID="LN">638 </FONT><A NAME="638"></A>
<FONT ID="LN">639 </FONT><A NAME="639"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">640 </FONT><A NAME="640"></A>     * @inheritDoc
<FONT ID="LN">641 </FONT><A NAME="641"></A>     */</FONT>
<FONT ID="LN">642 </FONT><A NAME="642"></A>
<FONT ID="LN">643 </FONT><A NAME="643"></A>    <FONT ID="Public">public</FONT> <FONT ID="Void">void</FONT> toSpim(PrintWriter out) {
<FONT ID="LN">644 </FONT><A NAME="644"></A>        out.printf(<FONT ID="StringLiteral">"    NLIRPutField.toSpim() not yet implemented!\n"</FONT>);
<FONT ID="LN">645 </FONT><A NAME="645"></A>    }
<FONT ID="LN">646 </FONT><A NAME="646"></A>
<FONT ID="LN">647 </FONT><A NAME="647"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">648 </FONT><A NAME="648"></A>     * @inheritDoc
<FONT ID="LN">649 </FONT><A NAME="649"></A>     */</FONT>
<FONT ID="LN">650 </FONT><A NAME="650"></A>
<FONT ID="LN">651 </FONT><A NAME="651"></A>    <FONT ID="Public">public</FONT> String toString() {
<FONT ID="LN">652 </FONT><A NAME="652"></A>        <FONT ID="Return">return</FONT> id + <FONT ID="StringLiteral">": "</FONT> + lirMnemonic[opcode] + <FONT ID="StringLiteral">" "</FONT> + target + <FONT ID="StringLiteral">"."</FONT> + name
<FONT ID="LN">653 </FONT><A NAME="653"></A>                + <FONT ID="StringLiteral">" = "</FONT> + reads.get(<FONT ID="IntegerLiteral">0</FONT>);
<FONT ID="LN">654 </FONT><A NAME="654"></A>    }
<FONT ID="LN">655 </FONT><A NAME="655"></A>
<FONT ID="LN">656 </FONT><A NAME="656"></A>}
<FONT ID="LN">657 </FONT><A NAME="657"></A>
<FONT ID="LN">658 </FONT><A NAME="658"></A><FONT ID="FormalComment">/**
<FONT ID="LN">659 </FONT><A NAME="659"></A> * LIR instruction representing JVM (get) field instructions.
<FONT ID="LN">660 </FONT><A NAME="660"></A> */</FONT>
<FONT ID="LN">661 </FONT><A NAME="661"></A>
<FONT ID="LN">662 </FONT><A NAME="662"></A><FONT ID="Class">class</FONT> NLIRGetField <FONT ID="Extends">extends</FONT> <A HREF="../jminusminus/NLIRInstruction.java.html">NLIRInstruction</A> {
<FONT ID="LN">663 </FONT><A NAME="663"></A>
<FONT ID="LN">664 </FONT><A NAME="664"></A>    <FONT ID="FormalComment">/** Opcode of the JVM instruction. */</FONT>
<FONT ID="LN">665 </FONT><A NAME="665"></A>    <FONT ID="Public">public</FONT> <FONT ID="Int">int</FONT> opcode;
<FONT ID="LN">666 </FONT><A NAME="666"></A>
<FONT ID="LN">667 </FONT><A NAME="667"></A>    <FONT ID="FormalComment">/** Target for the field. */</FONT>
<FONT ID="LN">668 </FONT><A NAME="668"></A>    <FONT ID="Public">public</FONT> String target;
<FONT ID="LN">669 </FONT><A NAME="669"></A>
<FONT ID="LN">670 </FONT><A NAME="670"></A>    <FONT ID="FormalComment">/** Name of the field being accessed. */</FONT>
<FONT ID="LN">671 </FONT><A NAME="671"></A>    <FONT ID="Public">public</FONT> String name;
<FONT ID="LN">672 </FONT><A NAME="672"></A>
<FONT ID="LN">673 </FONT><A NAME="673"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">674 </FONT><A NAME="674"></A>     * Construct an NLIRGetField instruction.
<FONT ID="LN">675 </FONT><A NAME="675"></A>     * 
<FONT ID="LN">676 </FONT><A NAME="676"></A>     * @param block
<FONT ID="LN">677 </FONT><A NAME="677"></A>     *            enclosing block.
<FONT ID="LN">678 </FONT><A NAME="678"></A>     * @param id
<FONT ID="LN">679 </FONT><A NAME="679"></A>     *            identifier of the instruction.
<FONT ID="LN">680 </FONT><A NAME="680"></A>     * @param opcode
<FONT ID="LN">681 </FONT><A NAME="681"></A>     *            JVM opcode for the return instruction.
<FONT ID="LN">682 </FONT><A NAME="682"></A>     * @param target
<FONT ID="LN">683 </FONT><A NAME="683"></A>     *            target for the field.
<FONT ID="LN">684 </FONT><A NAME="684"></A>     * @param name
<FONT ID="LN">685 </FONT><A NAME="685"></A>     *            name of the field.
<FONT ID="LN">686 </FONT><A NAME="686"></A>     * @param sType
<FONT ID="LN">687 </FONT><A NAME="687"></A>     *            type (short name) of the field.
<FONT ID="LN">688 </FONT><A NAME="688"></A>     * @param lType
<FONT ID="LN">689 </FONT><A NAME="689"></A>     *            type (long name) of the field.
<FONT ID="LN">690 </FONT><A NAME="690"></A>     */</FONT>
<FONT ID="LN">691 </FONT><A NAME="691"></A>
<FONT ID="LN">692 </FONT><A NAME="692"></A>    <FONT ID="Public">public</FONT> NLIRGetField(NBasicBlock block, <FONT ID="Int">int</FONT> id, <FONT ID="Int">int</FONT> opcode, String target,
<FONT ID="LN">693 </FONT><A NAME="693"></A>            String name, String sType, String lType) {
<FONT ID="LN">694 </FONT><A NAME="694"></A>        <FONT ID="Super">super</FONT>(block, id);
<FONT ID="LN">695 </FONT><A NAME="695"></A>        <FONT ID="This">this</FONT>.opcode = opcode;
<FONT ID="LN">696 </FONT><A NAME="696"></A>        <FONT ID="This">this</FONT>.target = target;
<FONT ID="LN">697 </FONT><A NAME="697"></A>        <FONT ID="This">this</FONT>.name = name;
<FONT ID="LN">698 </FONT><A NAME="698"></A>        write = <FONT ID="New">new</FONT> NVirtualRegister(NControlFlowGraph.regId++, sType, lType);
<FONT ID="LN">699 </FONT><A NAME="699"></A>        block.cfg.registers.add((NVirtualRegister) write);
<FONT ID="LN">700 </FONT><A NAME="700"></A>    }
<FONT ID="LN">701 </FONT><A NAME="701"></A>
<FONT ID="LN">702 </FONT><A NAME="702"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">703 </FONT><A NAME="703"></A>     * @inheritDoc
<FONT ID="LN">704 </FONT><A NAME="704"></A>     */</FONT>
<FONT ID="LN">705 </FONT><A NAME="705"></A>
<FONT ID="LN">706 </FONT><A NAME="706"></A>    <FONT ID="Public">public</FONT> <FONT ID="Void">void</FONT> toSpim(PrintWriter out) {
<FONT ID="LN">707 </FONT><A NAME="707"></A>        out.printf(<FONT ID="StringLiteral">"    NLIRGetField.toSpim() not yet implemented!\n"</FONT>);
<FONT ID="LN">708 </FONT><A NAME="708"></A>    }
<FONT ID="LN">709 </FONT><A NAME="709"></A>
<FONT ID="LN">710 </FONT><A NAME="710"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">711 </FONT><A NAME="711"></A>     * @inheritDoc
<FONT ID="LN">712 </FONT><A NAME="712"></A>     */</FONT>
<FONT ID="LN">713 </FONT><A NAME="713"></A>
<FONT ID="LN">714 </FONT><A NAME="714"></A>    <FONT ID="Public">public</FONT> String toString() {
<FONT ID="LN">715 </FONT><A NAME="715"></A>        <FONT ID="Return">return</FONT> id + <FONT ID="StringLiteral">": "</FONT> + lirMnemonic[opcode] + <FONT ID="StringLiteral">" "</FONT> + write + <FONT ID="StringLiteral">" = "</FONT> + target
<FONT ID="LN">716 </FONT><A NAME="716"></A>                + <FONT ID="StringLiteral">"."</FONT> + name;
<FONT ID="LN">717 </FONT><A NAME="717"></A>    }
<FONT ID="LN">718 </FONT><A NAME="718"></A>
<FONT ID="LN">719 </FONT><A NAME="719"></A>}
<FONT ID="LN">720 </FONT><A NAME="720"></A>
<FONT ID="LN">721 </FONT><A NAME="721"></A><FONT ID="FormalComment">/**
<FONT ID="LN">722 </FONT><A NAME="722"></A> * LIR instruction representing JVM array creation instructions.
<FONT ID="LN">723 </FONT><A NAME="723"></A> */</FONT>
<FONT ID="LN">724 </FONT><A NAME="724"></A>
<FONT ID="LN">725 </FONT><A NAME="725"></A><FONT ID="Class">class</FONT> NLIRNewArray <FONT ID="Extends">extends</FONT> <A HREF="../jminusminus/NLIRInstruction.java.html">NLIRInstruction</A> {
<FONT ID="LN">726 </FONT><A NAME="726"></A>
<FONT ID="LN">727 </FONT><A NAME="727"></A>    <FONT ID="FormalComment">/** Opcode of the JVM instruction. */</FONT>
<FONT ID="LN">728 </FONT><A NAME="728"></A>    <FONT ID="Public">public</FONT> <FONT ID="Int">int</FONT> opcode;
<FONT ID="LN">729 </FONT><A NAME="729"></A>
<FONT ID="LN">730 </FONT><A NAME="730"></A>    <FONT ID="FormalComment">/** Dimension of the array. */</FONT>
<FONT ID="LN">731 </FONT><A NAME="731"></A>    <FONT ID="Public">public</FONT> <FONT ID="Int">int</FONT> dim;
<FONT ID="LN">732 </FONT><A NAME="732"></A>
<FONT ID="LN">733 </FONT><A NAME="733"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">734 </FONT><A NAME="734"></A>     * Construct an NLIRNewArray instruction.
<FONT ID="LN">735 </FONT><A NAME="735"></A>     * 
<FONT ID="LN">736 </FONT><A NAME="736"></A>     * @param block
<FONT ID="LN">737 </FONT><A NAME="737"></A>     *            enclosing block.
<FONT ID="LN">738 </FONT><A NAME="738"></A>     * @param id
<FONT ID="LN">739 </FONT><A NAME="739"></A>     *            identifier of the instruction.
<FONT ID="LN">740 </FONT><A NAME="740"></A>     * @param opcode
<FONT ID="LN">741 </FONT><A NAME="741"></A>     *            JVM opcode for the instruction.
<FONT ID="LN">742 </FONT><A NAME="742"></A>     * @param dim
<FONT ID="LN">743 </FONT><A NAME="743"></A>     *            dimension of the array.
<FONT ID="LN">744 </FONT><A NAME="744"></A>     * @param sType
<FONT ID="LN">745 </FONT><A NAME="745"></A>     *            type (short name) of the array.
<FONT ID="LN">746 </FONT><A NAME="746"></A>     * @param lType
<FONT ID="LN">747 </FONT><A NAME="747"></A>     *            type (long name) of the array.
<FONT ID="LN">748 </FONT><A NAME="748"></A>     */</FONT>
<FONT ID="LN">749 </FONT><A NAME="749"></A>
<FONT ID="LN">750 </FONT><A NAME="750"></A>    <FONT ID="Public">public</FONT> NLIRNewArray(NBasicBlock block, <FONT ID="Int">int</FONT> id, <FONT ID="Int">int</FONT> opcode, <FONT ID="Int">int</FONT> dim,
<FONT ID="LN">751 </FONT><A NAME="751"></A>            String sType, String lType) {
<FONT ID="LN">752 </FONT><A NAME="752"></A>        <FONT ID="Super">super</FONT>(block, id);
<FONT ID="LN">753 </FONT><A NAME="753"></A>        <FONT ID="This">this</FONT>.opcode = opcode;
<FONT ID="LN">754 </FONT><A NAME="754"></A>        <FONT ID="This">this</FONT>.dim = dim;
<FONT ID="LN">755 </FONT><A NAME="755"></A>        write = <FONT ID="New">new</FONT> NVirtualRegister(NControlFlowGraph.regId++, sType, lType);
<FONT ID="LN">756 </FONT><A NAME="756"></A>        block.cfg.registers.add((NVirtualRegister) write);
<FONT ID="LN">757 </FONT><A NAME="757"></A>    }
<FONT ID="LN">758 </FONT><A NAME="758"></A>
<FONT ID="LN">759 </FONT><A NAME="759"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">760 </FONT><A NAME="760"></A>     * @inheritDoc
<FONT ID="LN">761 </FONT><A NAME="761"></A>     */</FONT>
<FONT ID="LN">762 </FONT><A NAME="762"></A>
<FONT ID="LN">763 </FONT><A NAME="763"></A>    <FONT ID="Public">public</FONT> <FONT ID="Void">void</FONT> toSpim(PrintWriter out) {
<FONT ID="LN">764 </FONT><A NAME="764"></A>        out.printf(<FONT ID="StringLiteral">"    NLIRNewArray.toSpim() not yet implemented!\n"</FONT>);
<FONT ID="LN">765 </FONT><A NAME="765"></A>    }
<FONT ID="LN">766 </FONT><A NAME="766"></A>
<FONT ID="LN">767 </FONT><A NAME="767"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">768 </FONT><A NAME="768"></A>     * @inheritDoc
<FONT ID="LN">769 </FONT><A NAME="769"></A>     */</FONT>
<FONT ID="LN">770 </FONT><A NAME="770"></A>
<FONT ID="LN">771 </FONT><A NAME="771"></A>    <FONT ID="Public">public</FONT> String toString() {
<FONT ID="LN">772 </FONT><A NAME="772"></A>        <FONT ID="Return">return</FONT> id + <FONT ID="StringLiteral">": "</FONT> + lirMnemonic[opcode] + <FONT ID="StringLiteral">" ["</FONT> + dim + <FONT ID="StringLiteral">"]"</FONT> + <FONT ID="StringLiteral">" "</FONT> + write;
<FONT ID="LN">773 </FONT><A NAME="773"></A>    }
<FONT ID="LN">774 </FONT><A NAME="774"></A>
<FONT ID="LN">775 </FONT><A NAME="775"></A>}
<FONT ID="LN">776 </FONT><A NAME="776"></A>
<FONT ID="LN">777 </FONT><A NAME="777"></A><FONT ID="FormalComment">/**
<FONT ID="LN">778 </FONT><A NAME="778"></A> * LIR instruction representing JVM array load instructions.
<FONT ID="LN">779 </FONT><A NAME="779"></A> */</FONT>
<FONT ID="LN">780 </FONT><A NAME="780"></A>
<FONT ID="LN">781 </FONT><A NAME="781"></A><FONT ID="Class">class</FONT> NLIRALoad <FONT ID="Extends">extends</FONT> <A HREF="../jminusminus/NLIRInstruction.java.html">NLIRInstruction</A> {
<FONT ID="LN">782 </FONT><A NAME="782"></A>
<FONT ID="LN">783 </FONT><A NAME="783"></A>    <FONT ID="FormalComment">/** Opcode of the JVM instruction. */</FONT>
<FONT ID="LN">784 </FONT><A NAME="784"></A>    <FONT ID="Public">public</FONT> <FONT ID="Int">int</FONT> opcode;
<FONT ID="LN">785 </FONT><A NAME="785"></A>
<FONT ID="LN">786 </FONT><A NAME="786"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">787 </FONT><A NAME="787"></A>     * Construct an NLIRALoad instruction.
<FONT ID="LN">788 </FONT><A NAME="788"></A>     * 
<FONT ID="LN">789 </FONT><A NAME="789"></A>     * @param block
<FONT ID="LN">790 </FONT><A NAME="790"></A>     *            enclosing block.
<FONT ID="LN">791 </FONT><A NAME="791"></A>     * @param id
<FONT ID="LN">792 </FONT><A NAME="792"></A>     *            identifier of the instruction.
<FONT ID="LN">793 </FONT><A NAME="793"></A>     * @param opcode
<FONT ID="LN">794 </FONT><A NAME="794"></A>     *            JVM opcode for the instruction.
<FONT ID="LN">795 </FONT><A NAME="795"></A>     * @param arrayRef
<FONT ID="LN">796 </FONT><A NAME="796"></A>     *            LIR of the array reference.
<FONT ID="LN">797 </FONT><A NAME="797"></A>     * @param index
<FONT ID="LN">798 </FONT><A NAME="798"></A>     *            LIR of the array index.
<FONT ID="LN">799 </FONT><A NAME="799"></A>     * @param sType
<FONT ID="LN">800 </FONT><A NAME="800"></A>     *            type (short name) of the array.
<FONT ID="LN">801 </FONT><A NAME="801"></A>     * @param lType
<FONT ID="LN">802 </FONT><A NAME="802"></A>     *            type (long name) of the array.
<FONT ID="LN">803 </FONT><A NAME="803"></A>     */</FONT>
<FONT ID="LN">804 </FONT><A NAME="804"></A>
<FONT ID="LN">805 </FONT><A NAME="805"></A>    <FONT ID="Public">public</FONT> NLIRALoad(NBasicBlock block, <FONT ID="Int">int</FONT> id, <FONT ID="Int">int</FONT> opcode,
<FONT ID="LN">806 </FONT><A NAME="806"></A>            <A HREF="../jminusminus/NLIRInstruction.java.html">NLIRInstruction</A> arrayRef, <A HREF="../jminusminus/NLIRInstruction.java.html">NLIRInstruction</A> index, String sType,
<FONT ID="LN">807 </FONT><A NAME="807"></A>            String lType) {
<FONT ID="LN">808 </FONT><A NAME="808"></A>        <FONT ID="Super">super</FONT>(block, id);
<FONT ID="LN">809 </FONT><A NAME="809"></A>        <FONT ID="This">this</FONT>.opcode = opcode;
<FONT ID="LN">810 </FONT><A NAME="810"></A>        reads.add(arrayRef.write);
<FONT ID="LN">811 </FONT><A NAME="811"></A>        reads.add(index.write);
<FONT ID="LN">812 </FONT><A NAME="812"></A>        write = <FONT ID="New">new</FONT> NVirtualRegister(NControlFlowGraph.regId++, sType, lType);
<FONT ID="LN">813 </FONT><A NAME="813"></A>        block.cfg.registers.add((NVirtualRegister) write);
<FONT ID="LN">814 </FONT><A NAME="814"></A>    }
<FONT ID="LN">815 </FONT><A NAME="815"></A>
<FONT ID="LN">816 </FONT><A NAME="816"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">817 </FONT><A NAME="817"></A>     * @inheritDoc
<FONT ID="LN">818 </FONT><A NAME="818"></A>     */</FONT>
<FONT ID="LN">819 </FONT><A NAME="819"></A>
<FONT ID="LN">820 </FONT><A NAME="820"></A>    <FONT ID="Public">public</FONT> <FONT ID="Void">void</FONT> toSpim(PrintWriter out) {
<FONT ID="LN">821 </FONT><A NAME="821"></A>        out.printf(<FONT ID="StringLiteral">"    NLIRALoad.toSpim() not yet implemented!\n"</FONT>);
<FONT ID="LN">822 </FONT><A NAME="822"></A>    }
<FONT ID="LN">823 </FONT><A NAME="823"></A>
<FONT ID="LN">824 </FONT><A NAME="824"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">825 </FONT><A NAME="825"></A>     * @inheritDoc
<FONT ID="LN">826 </FONT><A NAME="826"></A>     */</FONT>
<FONT ID="LN">827 </FONT><A NAME="827"></A>
<FONT ID="LN">828 </FONT><A NAME="828"></A>    <FONT ID="Public">public</FONT> String toString() {
<FONT ID="LN">829 </FONT><A NAME="829"></A>        <FONT ID="Return">return</FONT> id + <FONT ID="StringLiteral">": "</FONT> + lirMnemonic[opcode] + <FONT ID="StringLiteral">" "</FONT> + write + <FONT ID="StringLiteral">"= "</FONT>
<FONT ID="LN">830 </FONT><A NAME="830"></A>                + reads.get(<FONT ID="IntegerLiteral">0</FONT>) + <FONT ID="StringLiteral">"["</FONT> + reads.get(<FONT ID="IntegerLiteral">1</FONT>) + <FONT ID="StringLiteral">"]"</FONT>;
<FONT ID="LN">831 </FONT><A NAME="831"></A>    }
<FONT ID="LN">832 </FONT><A NAME="832"></A>
<FONT ID="LN">833 </FONT><A NAME="833"></A>}
<FONT ID="LN">834 </FONT><A NAME="834"></A>
<FONT ID="LN">835 </FONT><A NAME="835"></A><FONT ID="FormalComment">/**
<FONT ID="LN">836 </FONT><A NAME="836"></A> * LIR instruction representing JVM array store instructions.
<FONT ID="LN">837 </FONT><A NAME="837"></A> */</FONT>
<FONT ID="LN">838 </FONT><A NAME="838"></A>
<FONT ID="LN">839 </FONT><A NAME="839"></A><FONT ID="Class">class</FONT> NLIRAStore <FONT ID="Extends">extends</FONT> <A HREF="../jminusminus/NLIRInstruction.java.html">NLIRInstruction</A> {
<FONT ID="LN">840 </FONT><A NAME="840"></A>
<FONT ID="LN">841 </FONT><A NAME="841"></A>    <FONT ID="FormalComment">/** Opcode of the JVM instruction. */</FONT>
<FONT ID="LN">842 </FONT><A NAME="842"></A>    <FONT ID="Public">public</FONT> <FONT ID="Int">int</FONT> opcode;
<FONT ID="LN">843 </FONT><A NAME="843"></A>
<FONT ID="LN">844 </FONT><A NAME="844"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">845 </FONT><A NAME="845"></A>     * Construct an NLIRAStore instruction.
<FONT ID="LN">846 </FONT><A NAME="846"></A>     * 
<FONT ID="LN">847 </FONT><A NAME="847"></A>     * @param block
<FONT ID="LN">848 </FONT><A NAME="848"></A>     *            enclosing block.
<FONT ID="LN">849 </FONT><A NAME="849"></A>     * @param id
<FONT ID="LN">850 </FONT><A NAME="850"></A>     *            identifier of the instruction.
<FONT ID="LN">851 </FONT><A NAME="851"></A>     * @param opcode
<FONT ID="LN">852 </FONT><A NAME="852"></A>     *            JVM opcode for the instruction.
<FONT ID="LN">853 </FONT><A NAME="853"></A>     * @param arrayRef
<FONT ID="LN">854 </FONT><A NAME="854"></A>     *            LIR of the array reference.
<FONT ID="LN">855 </FONT><A NAME="855"></A>     * @param index
<FONT ID="LN">856 </FONT><A NAME="856"></A>     *            LIR of the array index.
<FONT ID="LN">857 </FONT><A NAME="857"></A>     * @param value
<FONT ID="LN">858 </FONT><A NAME="858"></A>     *            LIR of the value to store.
<FONT ID="LN">859 </FONT><A NAME="859"></A>     * @param sType
<FONT ID="LN">860 </FONT><A NAME="860"></A>     *            type (short name) of the array.
<FONT ID="LN">861 </FONT><A NAME="861"></A>     * @param lType
<FONT ID="LN">862 </FONT><A NAME="862"></A>     *            type (long name) of the array.
<FONT ID="LN">863 </FONT><A NAME="863"></A>     */</FONT>
<FONT ID="LN">864 </FONT><A NAME="864"></A>
<FONT ID="LN">865 </FONT><A NAME="865"></A>    <FONT ID="Public">public</FONT> NLIRAStore(NBasicBlock block, <FONT ID="Int">int</FONT> id, <FONT ID="Int">int</FONT> opcode,
<FONT ID="LN">866 </FONT><A NAME="866"></A>            <A HREF="../jminusminus/NLIRInstruction.java.html">NLIRInstruction</A> arrayRef, <A HREF="../jminusminus/NLIRInstruction.java.html">NLIRInstruction</A> index,
<FONT ID="LN">867 </FONT><A NAME="867"></A>            <A HREF="../jminusminus/NLIRInstruction.java.html">NLIRInstruction</A> value, String sType, String lType) {
<FONT ID="LN">868 </FONT><A NAME="868"></A>        <FONT ID="Super">super</FONT>(block, id);
<FONT ID="LN">869 </FONT><A NAME="869"></A>        <FONT ID="This">this</FONT>.opcode = opcode;
<FONT ID="LN">870 </FONT><A NAME="870"></A>        reads.add(arrayRef.write);
<FONT ID="LN">871 </FONT><A NAME="871"></A>        reads.add(index.write);
<FONT ID="LN">872 </FONT><A NAME="872"></A>        reads.add(value.write);
<FONT ID="LN">873 </FONT><A NAME="873"></A>    }
<FONT ID="LN">874 </FONT><A NAME="874"></A>
<FONT ID="LN">875 </FONT><A NAME="875"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">876 </FONT><A NAME="876"></A>     * @inheritDoc
<FONT ID="LN">877 </FONT><A NAME="877"></A>     */</FONT>
<FONT ID="LN">878 </FONT><A NAME="878"></A>
<FONT ID="LN">879 </FONT><A NAME="879"></A>    <FONT ID="Public">public</FONT> <FONT ID="Void">void</FONT> toSpim(PrintWriter out) {
<FONT ID="LN">880 </FONT><A NAME="880"></A>        out.printf(<FONT ID="StringLiteral">"    NLIRAStore.toSpim() not yet implemented!\n"</FONT>);
<FONT ID="LN">881 </FONT><A NAME="881"></A>    }
<FONT ID="LN">882 </FONT><A NAME="882"></A>
<FONT ID="LN">883 </FONT><A NAME="883"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">884 </FONT><A NAME="884"></A>     * @inheritDoc
<FONT ID="LN">885 </FONT><A NAME="885"></A>     */</FONT>
<FONT ID="LN">886 </FONT><A NAME="886"></A>
<FONT ID="LN">887 </FONT><A NAME="887"></A>    <FONT ID="Public">public</FONT> String toString() {
<FONT ID="LN">888 </FONT><A NAME="888"></A>        <FONT ID="Return">return</FONT> id + <FONT ID="StringLiteral">": "</FONT> + lirMnemonic[opcode] + <FONT ID="StringLiteral">" "</FONT> + reads.get(<FONT ID="IntegerLiteral">0</FONT>) + <FONT ID="StringLiteral">"["</FONT>
<FONT ID="LN">889 </FONT><A NAME="889"></A>                + reads.get(<FONT ID="IntegerLiteral">1</FONT>) + <FONT ID="StringLiteral">"] = "</FONT> + reads.get(<FONT ID="IntegerLiteral">2</FONT>);
<FONT ID="LN">890 </FONT><A NAME="890"></A>    }
<FONT ID="LN">891 </FONT><A NAME="891"></A>
<FONT ID="LN">892 </FONT><A NAME="892"></A>}
<FONT ID="LN">893 </FONT><A NAME="893"></A>
<FONT ID="LN">894 </FONT><A NAME="894"></A><FONT ID="FormalComment">/**
<FONT ID="LN">895 </FONT><A NAME="895"></A> * LIR instruction representing phi functions.
<FONT ID="LN">896 </FONT><A NAME="896"></A> */</FONT>
<FONT ID="LN">897 </FONT><A NAME="897"></A>
<FONT ID="LN">898 </FONT><A NAME="898"></A><FONT ID="Class">class</FONT> NLIRPhiFunction <FONT ID="Extends">extends</FONT> <A HREF="../jminusminus/NLIRInstruction.java.html">NLIRInstruction</A> {
<FONT ID="LN">899 </FONT><A NAME="899"></A>
<FONT ID="LN">900 </FONT><A NAME="900"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">901 </FONT><A NAME="901"></A>     * Construct an NLIRPhiFunction instruction.
<FONT ID="LN">902 </FONT><A NAME="902"></A>     * 
<FONT ID="LN">903 </FONT><A NAME="903"></A>     * @param block
<FONT ID="LN">904 </FONT><A NAME="904"></A>     *            enclosing block.
<FONT ID="LN">905 </FONT><A NAME="905"></A>     * @param id
<FONT ID="LN">906 </FONT><A NAME="906"></A>     *            identifier of the instruction.
<FONT ID="LN">907 </FONT><A NAME="907"></A>     * @param sType
<FONT ID="LN">908 </FONT><A NAME="908"></A>     *            type (short name) of the phi function.
<FONT ID="LN">909 </FONT><A NAME="909"></A>     * @param lType
<FONT ID="LN">910 </FONT><A NAME="910"></A>     *            type (long name) of the phi function.
<FONT ID="LN">911 </FONT><A NAME="911"></A>     */</FONT>
<FONT ID="LN">912 </FONT><A NAME="912"></A>
<FONT ID="LN">913 </FONT><A NAME="913"></A>    <FONT ID="Public">public</FONT> NLIRPhiFunction(NBasicBlock block, <FONT ID="Int">int</FONT> id, String sType, String lType) {
<FONT ID="LN">914 </FONT><A NAME="914"></A>        <FONT ID="Super">super</FONT>(block, id);
<FONT ID="LN">915 </FONT><A NAME="915"></A>        write = <FONT ID="New">new</FONT> NVirtualRegister(NControlFlowGraph.regId++, sType, lType);
<FONT ID="LN">916 </FONT><A NAME="916"></A>        block.cfg.registers.add((NVirtualRegister) write);
<FONT ID="LN">917 </FONT><A NAME="917"></A>    }
<FONT ID="LN">918 </FONT><A NAME="918"></A>
<FONT ID="LN">919 </FONT><A NAME="919"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">920 </FONT><A NAME="920"></A>     * @inheritDoc
<FONT ID="LN">921 </FONT><A NAME="921"></A>     */</FONT>
<FONT ID="LN">922 </FONT><A NAME="922"></A>
<FONT ID="LN">923 </FONT><A NAME="923"></A>    <FONT ID="Public">public</FONT> String toString() {
<FONT ID="LN">924 </FONT><A NAME="924"></A>        <FONT ID="Return">return</FONT> id + <FONT ID="StringLiteral">": phi "</FONT> + write;
<FONT ID="LN">925 </FONT><A NAME="925"></A>    }
<FONT ID="LN">926 </FONT><A NAME="926"></A>
<FONT ID="LN">927 </FONT><A NAME="927"></A>}
<FONT ID="LN">928 </FONT><A NAME="928"></A>
<FONT ID="LN">929 </FONT><A NAME="929"></A><FONT ID="FormalComment">/**
<FONT ID="LN">930 </FONT><A NAME="930"></A> * LIR move instruction.
<FONT ID="LN">931 </FONT><A NAME="931"></A> */</FONT>
<FONT ID="LN">932 </FONT><A NAME="932"></A>
<FONT ID="LN">933 </FONT><A NAME="933"></A><FONT ID="Class">class</FONT> NLIRMove <FONT ID="Extends">extends</FONT> <A HREF="../jminusminus/NLIRInstruction.java.html">NLIRInstruction</A> {
<FONT ID="LN">934 </FONT><A NAME="934"></A>
<FONT ID="LN">935 </FONT><A NAME="935"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">936 </FONT><A NAME="936"></A>     * Construct an NLIRMove instruction.
<FONT ID="LN">937 </FONT><A NAME="937"></A>     * 
<FONT ID="LN">938 </FONT><A NAME="938"></A>     * @param block
<FONT ID="LN">939 </FONT><A NAME="939"></A>     *            enclosing block.
<FONT ID="LN">940 </FONT><A NAME="940"></A>     * @param id
<FONT ID="LN">941 </FONT><A NAME="941"></A>     *            identifier of the instruction.
<FONT ID="LN">942 </FONT><A NAME="942"></A>     * @param from
<FONT ID="LN">943 </FONT><A NAME="943"></A>     *            LIR to move from.
<FONT ID="LN">944 </FONT><A NAME="944"></A>     * @param to
<FONT ID="LN">945 </FONT><A NAME="945"></A>     *            LIR to move to.
<FONT ID="LN">946 </FONT><A NAME="946"></A>     */</FONT>
<FONT ID="LN">947 </FONT><A NAME="947"></A>
<FONT ID="LN">948 </FONT><A NAME="948"></A>    <FONT ID="Public">public</FONT> NLIRMove(NBasicBlock block, <FONT ID="Int">int</FONT> id, <A HREF="../jminusminus/NLIRInstruction.java.html">NLIRInstruction</A> from,
<FONT ID="LN">949 </FONT><A NAME="949"></A>            <A HREF="../jminusminus/NLIRInstruction.java.html">NLIRInstruction</A> to) {
<FONT ID="LN">950 </FONT><A NAME="950"></A>        <FONT ID="Super">super</FONT>(block, id);
<FONT ID="LN">951 </FONT><A NAME="951"></A>        reads.add(from.write);
<FONT ID="LN">952 </FONT><A NAME="952"></A>        write = to.write;
<FONT ID="LN">953 </FONT><A NAME="953"></A>    }
<FONT ID="LN">954 </FONT><A NAME="954"></A>
<FONT ID="LN">955 </FONT><A NAME="955"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">956 </FONT><A NAME="956"></A>     * Construct an NLIRMove instruction.
<FONT ID="LN">957 </FONT><A NAME="957"></A>     * 
<FONT ID="LN">958 </FONT><A NAME="958"></A>     * @param block
<FONT ID="LN">959 </FONT><A NAME="959"></A>     *            enclosing block.
<FONT ID="LN">960 </FONT><A NAME="960"></A>     * @param id
<FONT ID="LN">961 </FONT><A NAME="961"></A>     *            identifier of the instruction.
<FONT ID="LN">962 </FONT><A NAME="962"></A>     * @param from
<FONT ID="LN">963 </FONT><A NAME="963"></A>     *            register (virtual or physical) to move from.
<FONT ID="LN">964 </FONT><A NAME="964"></A>     * @param to
<FONT ID="LN">965 </FONT><A NAME="965"></A>     *            register (virtual or physical) to move to.
<FONT ID="LN">966 </FONT><A NAME="966"></A>     */</FONT>
<FONT ID="LN">967 </FONT><A NAME="967"></A>
<FONT ID="LN">968 </FONT><A NAME="968"></A>    <FONT ID="Public">public</FONT> NLIRMove(NBasicBlock block, <FONT ID="Int">int</FONT> id, <A HREF="../jminusminus/NRegister.java.html">NRegister</A> from, <A HREF="../jminusminus/NRegister.java.html">NRegister</A> to) {
<FONT ID="LN">969 </FONT><A NAME="969"></A>        <FONT ID="Super">super</FONT>(block, id);
<FONT ID="LN">970 </FONT><A NAME="970"></A>        reads.add(from);
<FONT ID="LN">971 </FONT><A NAME="971"></A>        write = to;
<FONT ID="LN">972 </FONT><A NAME="972"></A>    }
<FONT ID="LN">973 </FONT><A NAME="973"></A>
<FONT ID="LN">974 </FONT><A NAME="974"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">975 </FONT><A NAME="975"></A>     * @inheritDoc
<FONT ID="LN">976 </FONT><A NAME="976"></A>     */</FONT>
<FONT ID="LN">977 </FONT><A NAME="977"></A>
<FONT ID="LN">978 </FONT><A NAME="978"></A>    <FONT ID="Public">public</FONT> <FONT ID="Void">void</FONT> allocatePhysicalRegisters() {
<FONT ID="LN">979 </FONT><A NAME="979"></A>        <A HREF="../jminusminus/NInterval.java.html">NInterval</A> input = block.cfg.intervals.get(reads.get(<FONT ID="IntegerLiteral">0</FONT>).number())
<FONT ID="LN">980 </FONT><A NAME="980"></A>                .childAt(id);
<FONT ID="LN">981 </FONT><A NAME="981"></A>        ;
<FONT ID="LN">982 </FONT><A NAME="982"></A>        <A HREF="../jminusminus/NInterval.java.html">NInterval</A> output = block.cfg.intervals.get(write.number()).childAt(id);
<FONT ID="LN">983 </FONT><A NAME="983"></A>        reads.set(<FONT ID="IntegerLiteral">0</FONT>, input.pRegister);
<FONT ID="LN">984 </FONT><A NAME="984"></A>        write = output.pRegister;
<FONT ID="LN">985 </FONT><A NAME="985"></A>    }
<FONT ID="LN">986 </FONT><A NAME="986"></A>
<FONT ID="LN">987 </FONT><A NAME="987"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">988 </FONT><A NAME="988"></A>     * @inheritDoc
<FONT ID="LN">989 </FONT><A NAME="989"></A>     */</FONT>
<FONT ID="LN">990 </FONT><A NAME="990"></A>
<FONT ID="LN">991 </FONT><A NAME="991"></A>    <FONT ID="Public">public</FONT> <FONT ID="Void">void</FONT> toSpim(PrintWriter out) {
<FONT ID="LN">992 </FONT><A NAME="992"></A>        out.printf(<FONT ID="StringLiteral">"    move %s,%s\n"</FONT>, write, reads.get(<FONT ID="IntegerLiteral">0</FONT>));
<FONT ID="LN">993 </FONT><A NAME="993"></A>    }
<FONT ID="LN">994 </FONT><A NAME="994"></A>
<FONT ID="LN">995 </FONT><A NAME="995"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">996 </FONT><A NAME="996"></A>     * @inheritDoc
<FONT ID="LN">997 </FONT><A NAME="997"></A>     */</FONT>
<FONT ID="LN">998 </FONT><A NAME="998"></A>
<FONT ID="LN">999 </FONT><A NAME="999"></A>    <FONT ID="Public">public</FONT> String toString() {
<FONT ID="LN">1000</FONT><A NAME="1000"></A>        <FONT ID="Return">return</FONT> id + <FONT ID="StringLiteral">": MOVE "</FONT> + reads.get(<FONT ID="IntegerLiteral">0</FONT>) + <FONT ID="StringLiteral">" "</FONT> + write;
<FONT ID="LN">1001</FONT><A NAME="1001"></A>    }
<FONT ID="LN">1002</FONT><A NAME="1002"></A>
<FONT ID="LN">1003</FONT><A NAME="1003"></A>}
<FONT ID="LN">1004</FONT><A NAME="1004"></A>
<FONT ID="LN">1005</FONT><A NAME="1005"></A><FONT ID="FormalComment">/**
<FONT ID="LN">1006</FONT><A NAME="1006"></A> * LIR instruction representing a formal parameter.
<FONT ID="LN">1007</FONT><A NAME="1007"></A> */</FONT>
<FONT ID="LN">1008</FONT><A NAME="1008"></A>
<FONT ID="LN">1009</FONT><A NAME="1009"></A><FONT ID="Class">class</FONT> NLIRLoadLocal <FONT ID="Extends">extends</FONT> <A HREF="../jminusminus/NLIRInstruction.java.html">NLIRInstruction</A> {
<FONT ID="LN">1010</FONT><A NAME="1010"></A>
<FONT ID="LN">1011</FONT><A NAME="1011"></A>    <FONT ID="FormalComment">/** Local variable index. */</FONT>
<FONT ID="LN">1012</FONT><A NAME="1012"></A>    <FONT ID="Public">public</FONT> <FONT ID="Int">int</FONT> local;
<FONT ID="LN">1013</FONT><A NAME="1013"></A>
<FONT ID="LN">1014</FONT><A NAME="1014"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">1015</FONT><A NAME="1015"></A>     * Construct an NLIRLoadLocal instruction.
<FONT ID="LN">1016</FONT><A NAME="1016"></A>     * 
<FONT ID="LN">1017</FONT><A NAME="1017"></A>     * @param block
<FONT ID="LN">1018</FONT><A NAME="1018"></A>     *            enclosing block.
<FONT ID="LN">1019</FONT><A NAME="1019"></A>     * @param id
<FONT ID="LN">1020</FONT><A NAME="1020"></A>     *            identifier of the instruction.
<FONT ID="LN">1021</FONT><A NAME="1021"></A>     * @param local
<FONT ID="LN">1022</FONT><A NAME="1022"></A>     *            local variable index.
<FONT ID="LN">1023</FONT><A NAME="1023"></A>     * @param sType
<FONT ID="LN">1024</FONT><A NAME="1024"></A>     *            short type name of the instruction.
<FONT ID="LN">1025</FONT><A NAME="1025"></A>     * @param lType
<FONT ID="LN">1026</FONT><A NAME="1026"></A>     *            long type name of the instruction.
<FONT ID="LN">1027</FONT><A NAME="1027"></A>     */</FONT>
<FONT ID="LN">1028</FONT><A NAME="1028"></A>
<FONT ID="LN">1029</FONT><A NAME="1029"></A>    <FONT ID="Public">public</FONT> NLIRLoadLocal(NBasicBlock block, <FONT ID="Int">int</FONT> id, <FONT ID="Int">int</FONT> local, String sType,
<FONT ID="LN">1030</FONT><A NAME="1030"></A>            String lType) {
<FONT ID="LN">1031</FONT><A NAME="1031"></A>        <FONT ID="Super">super</FONT>(block, id);
<FONT ID="LN">1032</FONT><A NAME="1032"></A>        <FONT ID="This">this</FONT>.local = local;
<FONT ID="LN">1033</FONT><A NAME="1033"></A>        <FONT ID="If">if</FONT> (local &lt; <FONT ID="IntegerLiteral">4</FONT>) {
<FONT ID="LN">1034</FONT><A NAME="1034"></A>            write = NPhysicalRegister.regInfo[A0 + local];
<FONT ID="LN">1035</FONT><A NAME="1035"></A>            block.cfg.registers.set(A0 + local, NPhysicalRegister.regInfo[A0
<FONT ID="LN">1036</FONT><A NAME="1036"></A>                    + local]);
<FONT ID="LN">1037</FONT><A NAME="1037"></A>        } <FONT ID="Else">else</FONT> {
<FONT ID="LN">1038</FONT><A NAME="1038"></A>            write = <FONT ID="New">new</FONT> NVirtualRegister(NControlFlowGraph.regId++, sType,
<FONT ID="LN">1039</FONT><A NAME="1039"></A>                    lType);
<FONT ID="LN">1040</FONT><A NAME="1040"></A>            block.cfg.registers.add((NVirtualRegister) write);
<FONT ID="LN">1041</FONT><A NAME="1041"></A>        }
<FONT ID="LN">1042</FONT><A NAME="1042"></A>    }
<FONT ID="LN">1043</FONT><A NAME="1043"></A>
<FONT ID="LN">1044</FONT><A NAME="1044"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">1045</FONT><A NAME="1045"></A>     * @inheritDoc
<FONT ID="LN">1046</FONT><A NAME="1046"></A>     */</FONT>
<FONT ID="LN">1047</FONT><A NAME="1047"></A>
<FONT ID="LN">1048</FONT><A NAME="1048"></A>    <FONT ID="Public">public</FONT> String toString() {
<FONT ID="LN">1049</FONT><A NAME="1049"></A>        <FONT ID="Return">return</FONT> id + <FONT ID="StringLiteral">": LDLOC "</FONT> + local + <FONT ID="StringLiteral">" "</FONT> + write;
<FONT ID="LN">1050</FONT><A NAME="1050"></A>    }
<FONT ID="LN">1051</FONT><A NAME="1051"></A>
<FONT ID="LN">1052</FONT><A NAME="1052"></A>}
<FONT ID="LN">1053</FONT><A NAME="1053"></A>
<FONT ID="LN">1054</FONT><A NAME="1054"></A><FONT ID="FormalComment">/**
<FONT ID="LN">1055</FONT><A NAME="1055"></A> * LIR instruction representing a load from memory to register.
<FONT ID="LN">1056</FONT><A NAME="1056"></A> */</FONT>
<FONT ID="LN">1057</FONT><A NAME="1057"></A>
<FONT ID="LN">1058</FONT><A NAME="1058"></A><FONT ID="Class">class</FONT> NLIRLoad <FONT ID="Extends">extends</FONT> <A HREF="../jminusminus/NLIRInstruction.java.html">NLIRInstruction</A> {
<FONT ID="LN">1059</FONT><A NAME="1059"></A>
<FONT ID="LN">1060</FONT><A NAME="1060"></A>    <FONT ID="FormalComment">/** Stack offset to load from. */</FONT>
<FONT ID="LN">1061</FONT><A NAME="1061"></A>    <FONT ID="Private">private</FONT> <FONT ID="Int">int</FONT> offset;
<FONT ID="LN">1062</FONT><A NAME="1062"></A>
<FONT ID="LN">1063</FONT><A NAME="1063"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">1064</FONT><A NAME="1064"></A>     * Whether offset is relative to stack pointer (sp) or frame pointer (fp).
<FONT ID="LN">1065</FONT><A NAME="1065"></A>     */</FONT>
<FONT ID="LN">1066</FONT><A NAME="1066"></A>    <FONT ID="Private">private</FONT> OffsetFrom offsetFrom;
<FONT ID="LN">1067</FONT><A NAME="1067"></A>
<FONT ID="LN">1068</FONT><A NAME="1068"></A>    <FONT ID="FormalComment">/** Register to load to. */</FONT>
<FONT ID="LN">1069</FONT><A NAME="1069"></A>    <FONT ID="Private">private</FONT> <A HREF="../jminusminus/NRegister.java.html">NRegister</A> register;
<FONT ID="LN">1070</FONT><A NAME="1070"></A>
<FONT ID="LN">1071</FONT><A NAME="1071"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">1072</FONT><A NAME="1072"></A>     * Construct an NLIRLoad instruction.
<FONT ID="LN">1073</FONT><A NAME="1073"></A>     * 
<FONT ID="LN">1074</FONT><A NAME="1074"></A>     * @param block
<FONT ID="LN">1075</FONT><A NAME="1075"></A>     *            enclosing block.
<FONT ID="LN">1076</FONT><A NAME="1076"></A>     * @param id
<FONT ID="LN">1077</FONT><A NAME="1077"></A>     *            identifier of the instruction.
<FONT ID="LN">1078</FONT><A NAME="1078"></A>     * @param offset
<FONT ID="LN">1079</FONT><A NAME="1079"></A>     *            stack offset to load from.
<FONT ID="LN">1080</FONT><A NAME="1080"></A>     * @param offsetFrom
<FONT ID="LN">1081</FONT><A NAME="1081"></A>     *            whether offset relative to stack pointer (sp) or frame pointer
<FONT ID="LN">1082</FONT><A NAME="1082"></A>     *            (fp).
<FONT ID="LN">1083</FONT><A NAME="1083"></A>     * @param register
<FONT ID="LN">1084</FONT><A NAME="1084"></A>     *            register to load to.
<FONT ID="LN">1085</FONT><A NAME="1085"></A>     */</FONT>
<FONT ID="LN">1086</FONT><A NAME="1086"></A>
<FONT ID="LN">1087</FONT><A NAME="1087"></A>    <FONT ID="Public">public</FONT> NLIRLoad(NBasicBlock block, <FONT ID="Int">int</FONT> id, <FONT ID="Int">int</FONT> offset,
<FONT ID="LN">1088</FONT><A NAME="1088"></A>            OffsetFrom offsetFrom, <A HREF="../jminusminus/NRegister.java.html">NRegister</A> register) {
<FONT ID="LN">1089</FONT><A NAME="1089"></A>        <FONT ID="Super">super</FONT>(block, id);
<FONT ID="LN">1090</FONT><A NAME="1090"></A>        <FONT ID="This">this</FONT>.offset = offset;
<FONT ID="LN">1091</FONT><A NAME="1091"></A>        <FONT ID="This">this</FONT>.offsetFrom = offsetFrom;
<FONT ID="LN">1092</FONT><A NAME="1092"></A>        <FONT ID="This">this</FONT>.register = register;
<FONT ID="LN">1093</FONT><A NAME="1093"></A>    }
<FONT ID="LN">1094</FONT><A NAME="1094"></A>
<FONT ID="LN">1095</FONT><A NAME="1095"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">1096</FONT><A NAME="1096"></A>     * @inheritDoc
<FONT ID="LN">1097</FONT><A NAME="1097"></A>     */</FONT>
<FONT ID="LN">1098</FONT><A NAME="1098"></A>
<FONT ID="LN">1099</FONT><A NAME="1099"></A>    <FONT ID="Public">public</FONT> <FONT ID="Void">void</FONT> toSpim(PrintWriter out) {
<FONT ID="LN">1100</FONT><A NAME="1100"></A>        <FONT ID="If">if</FONT> (offsetFrom == OffsetFrom.FP) {
<FONT ID="LN">1101</FONT><A NAME="1101"></A>            out.printf(<FONT ID="StringLiteral">"    lw %s,%d($fp)\n"</FONT>, register, offset * <FONT ID="IntegerLiteral">4</FONT>);
<FONT ID="LN">1102</FONT><A NAME="1102"></A>        } <FONT ID="Else">else</FONT> {
<FONT ID="LN">1103</FONT><A NAME="1103"></A>            out.printf(<FONT ID="StringLiteral">"    lw %s,%d($sp)\n"</FONT>, register, offset * <FONT ID="IntegerLiteral">4</FONT>);
<FONT ID="LN">1104</FONT><A NAME="1104"></A>        }
<FONT ID="LN">1105</FONT><A NAME="1105"></A>    }
<FONT ID="LN">1106</FONT><A NAME="1106"></A>
<FONT ID="LN">1107</FONT><A NAME="1107"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">1108</FONT><A NAME="1108"></A>     * @inheritDoc
<FONT ID="LN">1109</FONT><A NAME="1109"></A>     */</FONT>
<FONT ID="LN">1110</FONT><A NAME="1110"></A>
<FONT ID="LN">1111</FONT><A NAME="1111"></A>    <FONT ID="Public">public</FONT> String toString() {
<FONT ID="LN">1112</FONT><A NAME="1112"></A>        <FONT ID="Return">return</FONT> id + <FONT ID="StringLiteral">": LOAD "</FONT>
<FONT ID="LN">1113</FONT><A NAME="1113"></A>                + (offsetFrom == OffsetFrom.FP ? <FONT ID="StringLiteral">"[frame:"</FONT> : <FONT ID="StringLiteral">"[stack:"</FONT>)
<FONT ID="LN">1114</FONT><A NAME="1114"></A>                + offset + <FONT ID="StringLiteral">"] "</FONT> + register;
<FONT ID="LN">1115</FONT><A NAME="1115"></A>    }
<FONT ID="LN">1116</FONT><A NAME="1116"></A>
<FONT ID="LN">1117</FONT><A NAME="1117"></A>}
<FONT ID="LN">1118</FONT><A NAME="1118"></A>
<FONT ID="LN">1119</FONT><A NAME="1119"></A><FONT ID="FormalComment">/**
<FONT ID="LN">1120</FONT><A NAME="1120"></A> * LIR instruction representing a store from a register to memory.
<FONT ID="LN">1121</FONT><A NAME="1121"></A> */</FONT>
<FONT ID="LN">1122</FONT><A NAME="1122"></A>
<FONT ID="LN">1123</FONT><A NAME="1123"></A><FONT ID="Class">class</FONT> NLIRStore <FONT ID="Extends">extends</FONT> <A HREF="../jminusminus/NLIRInstruction.java.html">NLIRInstruction</A> {
<FONT ID="LN">1124</FONT><A NAME="1124"></A>
<FONT ID="LN">1125</FONT><A NAME="1125"></A>    <FONT ID="FormalComment">/** Stack offset to store to. */</FONT>
<FONT ID="LN">1126</FONT><A NAME="1126"></A>    <FONT ID="Private">private</FONT> <FONT ID="Int">int</FONT> offset;
<FONT ID="LN">1127</FONT><A NAME="1127"></A>
<FONT ID="LN">1128</FONT><A NAME="1128"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">1129</FONT><A NAME="1129"></A>     * Whether offset is relative to stack pointer (sp) or frame pointer (fp).
<FONT ID="LN">1130</FONT><A NAME="1130"></A>     */</FONT>
<FONT ID="LN">1131</FONT><A NAME="1131"></A>    <FONT ID="Private">private</FONT> OffsetFrom offsetFrom;
<FONT ID="LN">1132</FONT><A NAME="1132"></A>
<FONT ID="LN">1133</FONT><A NAME="1133"></A>    <FONT ID="FormalComment">/** Register to store from. */</FONT>
<FONT ID="LN">1134</FONT><A NAME="1134"></A>    <FONT ID="Private">private</FONT> <A HREF="../jminusminus/NRegister.java.html">NRegister</A> register;
<FONT ID="LN">1135</FONT><A NAME="1135"></A>
<FONT ID="LN">1136</FONT><A NAME="1136"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">1137</FONT><A NAME="1137"></A>     * Construct an NLIRStore instruction.
<FONT ID="LN">1138</FONT><A NAME="1138"></A>     * 
<FONT ID="LN">1139</FONT><A NAME="1139"></A>     * @param block
<FONT ID="LN">1140</FONT><A NAME="1140"></A>     *            enclosing block.
<FONT ID="LN">1141</FONT><A NAME="1141"></A>     * @param id
<FONT ID="LN">1142</FONT><A NAME="1142"></A>     *            identifier of the instruction.
<FONT ID="LN">1143</FONT><A NAME="1143"></A>     * @param offset
<FONT ID="LN">1144</FONT><A NAME="1144"></A>     *            stack offset to store to.
<FONT ID="LN">1145</FONT><A NAME="1145"></A>     * @param offsetFrom
<FONT ID="LN">1146</FONT><A NAME="1146"></A>     *            whether offset relative to stack pointer (sp) or frame pointer
<FONT ID="LN">1147</FONT><A NAME="1147"></A>     *            (fp).
<FONT ID="LN">1148</FONT><A NAME="1148"></A>     * @param register
<FONT ID="LN">1149</FONT><A NAME="1149"></A>     *            register to store from.
<FONT ID="LN">1150</FONT><A NAME="1150"></A>     */</FONT>
<FONT ID="LN">1151</FONT><A NAME="1151"></A>
<FONT ID="LN">1152</FONT><A NAME="1152"></A>    <FONT ID="Public">public</FONT> NLIRStore(NBasicBlock block, <FONT ID="Int">int</FONT> id, <FONT ID="Int">int</FONT> offset,
<FONT ID="LN">1153</FONT><A NAME="1153"></A>            OffsetFrom offsetFrom, <A HREF="../jminusminus/NRegister.java.html">NRegister</A> register) {
<FONT ID="LN">1154</FONT><A NAME="1154"></A>        <FONT ID="Super">super</FONT>(block, id);
<FONT ID="LN">1155</FONT><A NAME="1155"></A>        <FONT ID="This">this</FONT>.offset = offset;
<FONT ID="LN">1156</FONT><A NAME="1156"></A>        <FONT ID="This">this</FONT>.offsetFrom = offsetFrom;
<FONT ID="LN">1157</FONT><A NAME="1157"></A>        <FONT ID="This">this</FONT>.register = register;
<FONT ID="LN">1158</FONT><A NAME="1158"></A>        reads.add(register);
<FONT ID="LN">1159</FONT><A NAME="1159"></A>    }
<FONT ID="LN">1160</FONT><A NAME="1160"></A>
<FONT ID="LN">1161</FONT><A NAME="1161"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">1162</FONT><A NAME="1162"></A>     * @inheritDoc
<FONT ID="LN">1163</FONT><A NAME="1163"></A>     */</FONT>
<FONT ID="LN">1164</FONT><A NAME="1164"></A>
<FONT ID="LN">1165</FONT><A NAME="1165"></A>    <FONT ID="Public">public</FONT> <FONT ID="Void">void</FONT> allocatePhysicalRegisters() {
<FONT ID="LN">1166</FONT><A NAME="1166"></A>        <A HREF="../jminusminus/NInterval.java.html">NInterval</A> input = block.cfg.intervals.get(reads.get(<FONT ID="IntegerLiteral">0</FONT>).number())
<FONT ID="LN">1167</FONT><A NAME="1167"></A>                .childAt(id);
<FONT ID="LN">1168</FONT><A NAME="1168"></A>        <FONT ID="If">if</FONT> (input.vRegId &gt;= <FONT ID="IntegerLiteral">32</FONT>) {
<FONT ID="LN">1169</FONT><A NAME="1169"></A>            reads.set(<FONT ID="IntegerLiteral">0</FONT>, input.pRegister);
<FONT ID="LN">1170</FONT><A NAME="1170"></A>        }
<FONT ID="LN">1171</FONT><A NAME="1171"></A>    }
<FONT ID="LN">1172</FONT><A NAME="1172"></A>
<FONT ID="LN">1173</FONT><A NAME="1173"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">1174</FONT><A NAME="1174"></A>     * @inheritDoc
<FONT ID="LN">1175</FONT><A NAME="1175"></A>     */</FONT>
<FONT ID="LN">1176</FONT><A NAME="1176"></A>
<FONT ID="LN">1177</FONT><A NAME="1177"></A>    <FONT ID="Public">public</FONT> <FONT ID="Void">void</FONT> toSpim(PrintWriter out) {
<FONT ID="LN">1178</FONT><A NAME="1178"></A>        <FONT ID="If">if</FONT> (offsetFrom == OffsetFrom.FP) {
<FONT ID="LN">1179</FONT><A NAME="1179"></A>            out.printf(<FONT ID="StringLiteral">"    sw %s,%d($fp)\n"</FONT>, reads.get(<FONT ID="IntegerLiteral">0</FONT>), offset * <FONT ID="IntegerLiteral">4</FONT>);
<FONT ID="LN">1180</FONT><A NAME="1180"></A>        } <FONT ID="Else">else</FONT> {
<FONT ID="LN">1181</FONT><A NAME="1181"></A>            out.printf(<FONT ID="StringLiteral">"    sw %s,%d($sp)\n"</FONT>, reads.get(<FONT ID="IntegerLiteral">0</FONT>), offset * <FONT ID="IntegerLiteral">4</FONT>);
<FONT ID="LN">1182</FONT><A NAME="1182"></A>        }
<FONT ID="LN">1183</FONT><A NAME="1183"></A>    }
<FONT ID="LN">1184</FONT><A NAME="1184"></A>
<FONT ID="LN">1185</FONT><A NAME="1185"></A>    <FONT ID="FormalComment">/**
<FONT ID="LN">1186</FONT><A NAME="1186"></A>     * @inheritDoc
<FONT ID="LN">1187</FONT><A NAME="1187"></A>     */</FONT>
<FONT ID="LN">1188</FONT><A NAME="1188"></A>
<FONT ID="LN">1189</FONT><A NAME="1189"></A>    <FONT ID="Public">public</FONT> String toString() {
<FONT ID="LN">1190</FONT><A NAME="1190"></A>        <FONT ID="Return">return</FONT> id + <FONT ID="StringLiteral">": STORE "</FONT> + reads.get(<FONT ID="IntegerLiteral">0</FONT>) + <FONT ID="StringLiteral">" "</FONT>
<FONT ID="LN">1191</FONT><A NAME="1191"></A>                + (offsetFrom == OffsetFrom.FP ? <FONT ID="StringLiteral">"[frame:"</FONT> : <FONT ID="StringLiteral">"[stack:"</FONT>)
<FONT ID="LN">1192</FONT><A NAME="1192"></A>                + offset + <FONT ID="StringLiteral">"]"</FONT>;
<FONT ID="LN">1193</FONT><A NAME="1193"></A>    }
<FONT ID="LN">1194</FONT><A NAME="1194"></A>
<FONT ID="LN">1195</FONT><A NAME="1195"></A>}
<FONT ID="LN">1196</FONT><A NAME="1196"></A></pre>
</BODY>
</HTML>